/v1/bulk/property/values
Get the values of a property for multiple nodes.
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/bulk/property/values/linked
instead.
To get a list of properties available for an node, see /v1/bulk/properties.
For single queries with a simpler output, see the simple version of this endpoint.
Request
https://api.datacommons.org/v1/bulk/property/values/{EDGE_DIRECTION}?property={property_dcid}&nodes={node_dcid_1}&nodes={node_dcid_2}&key={your_api_key}
URL:
https://api.datacommons.org/v1/bulk/property/values/{EDGE_DIRECTION}
Header:
X-API-Key: {your_api_key}
JSON Data:
{
"property": "property_dcid",
"nodes": [
"{node_dcid_1}",
"{node_dcid_2}",
...
]
}
Path Parameters
Name | Description |
---|---|
EDGE_DIRECTION |
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. |
Query Parameters
Name | Type | Description |
---|---|---|
key |
string | Your API key. See the page on authentication for a demo key, as well as instructions on how to get your own key. |
nodes |
list | DCIDs of the entitis to query. |
property |
string | DCID of the property to query. |
Response
The response looks like:
{
"data":
[
{
"node": "connected_node_dcid",
"values":
[
{
"property_of_connected_node_1": "value",
"property_of_connected_node_1": "value",
...
},
{
"property_of_connected_node_2": "value",
"property_of_connected_node_2": "value",
...
}
]
},
{
"node": "connected_node_dcid_2",
"values":
[
{
"property_of_connected_node_1": "value",
"property_of_connected_node_1": "value",
...
},
{
"property_of_connected_node_2": "value",
"property_of_connected_node_2": "value",
...
}
]
}, ...
]
}
Response fields
Name | Type | Description |
---|---|---|
node | string | DCID of the node queried. |
values | list | list of nodes connected by the property queried. |
Examples
Example 1: Get property values for multiple nodes
Get the names (property: name
) of nodes with DCIDs wikidataId/Q27119
,
wikidataId/Q27116
, and wikidataId/Q21181
.
-
Request:
$ curl --request GET --url \ 'https://api.datacommons.org/v1/bulk/property/values/out?property=name&nodes=wikidataId/Q27119&nodes=wikidataId/Q27116&nodes=wikidataId/Q21181&key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI'
-
Request:
$ curl --request POST \ --url https://api.datacommons.org/v1/bulk/property/values/out \ --header 'X-API-Key: AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI' \ --data '{"nodes":["wikidataId/Q27119", "wikidataId/Q27116", "wikidataId/Q21181"], "property":"name"}'
Response:
{
"data": [
{
"node": "wikidataId/Q27119",
"values": [
{
"provenanceId": "dc/5n63hr1",
"value": "Kolding"
}
]
},
{
"node": "wikidataId/Q27116",
"values": [
{
"provenanceId": "dc/5n63hr1",
"value": "Vejle"
}
]
},
{
"node": "wikidataId/Q21181",
"values": [
{
"provenanceId": "dc/5n63hr1",
"value": "Fredericia"
}
]
}
]
}
Page last updated: November 27, 2024 • Send feedback about this page