/v1/property/values

Get the values of a property for a specific node.

Data Commons represents properties as labels of directed edges between nodes, where the successor node is a value of the property. Thus, this endpoint returns nodes connected to the queried node via the property queried.

Note: If you want to query values for the property containedInPlace, consider using /v1/property/values/linked instead.

Request

GET Request

http://api.datacommons.org/v1/property/values/{EDGE_DIRECTION}/{NODE}/{PROPERTY}?key={your_api_key}

Path Parameters

Name Description
EDGE_DIRECTION
Required
One of in or out.

If in, returns nodes for which the queried node is a property value. If out, returns values of properties describing the node queried.
NODE
Required
DCID of the node to query.
PROPERTY
Required
DCID of the property to query.

Query Parameters

Name Type Description
key
Required
string Your API key. See the page on authentication for a demo key, as well as instructions on how to get your own key.

Response

The response looks like:

{
  "values":
  [
    {
      "property_1_of_connected_node": "value",
      "property_2_of_connected_node": "value",
      ...
    }, ...
  ]
}

Response fields

Name Type Description
values object values of the property queried, for the node queried.

Examples

Example 1: Get the value of a property for an node

Get the name of the node with DCID geoId/sch3620580 by querying the property name.

Request:

  $ curl --request GET --url \
  'https://api.datacommons.org/v1/property/values/out/geoId/sch3620580/name?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI'

Response:

{
  "values": [
    {
      "provenanceId": "dc/sm3m2w3",
      "value": "New York City Department Of Education"
    }
  ]
}

Example 2: Get the nodes that have the queried node as a property value

Get a list of natural disasters in Madagascar (DCID: country/MDG) by querying the property affectedPlace.

Request:

  $ curl --request GET --url \
  'https://api.datacommons.org/v1/property/values/in/country/MDG/affectedPlace?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI'

Response:

{
  "values":
  [
    {
      "name": "Unnamed SouthIndian Cyclone (1912324S11066)",
      "types":
      [
        "CycloneEvent"
      ],
      "dcid": "cyclone/ibtracs_1912324S11066",
      "provenanceId": "dc/xwq0y5"
    },
    {
      "name": "Unnamed SouthIndian Cyclone (1913022S12053)",
      "types":
      [
        "CycloneEvent"
      ],
      "dcid": "cyclone/ibtracs_1913022S12053",
      "provenanceId": "dc/xwq0y5"
    },
    < ... output  truncated for brevity ... >
    {
      "name": "32 km SSE of Maroantsetra, Madagascar",
      "types":
      [
        "EarthquakeEvent"
      ],
      "dcid": "earthquake/usp000h6zw",
      "provenanceId": "dc/xz8ndk3"
    },
    {
      "name": "23 km ENE of Amparafaravola, Madagascar",
      "types":
      [
        "EarthquakeEvent"
      ],
      "dcid": "earthquake/usp000jgbb",
      "provenanceId": "dc/xz8ndk3"
    }
  ]
}

Page last updated: December 17, 2024 • Send feedback about this page