/v1/observations/series

Retrieve series of observations from a specific variable for an entity from the preferred facet.

Request

GET Request

https://api.datacommons.org/v1/observations/series/{ENTITY_DCID}/{VARIABLE_DCID}?key={your_api_key}

Path Parameters

Name Description
VARIABLE_DCID
Required
DCID of the variable to query a value for.
ENTITY_DCID
Required
DCID of the entity that the variable describes.

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:

{
  "observations": [
    {
      "date": "YYYY-MM-DD",
      "value": 1234
    }, ...
  ],
  "facet": {
    "importName": "Name",
      "provenanceUrl": "https://provenance.url/",
      "measurementMethod": "MeasurementMethod",
      "unit": "unit"
  }
}

Response fields

Name Type Description
observations list A list of {date, value} pairs for the variable queried, where date is the date of measurement and value the measured value for the variable. Pairs are returned in chronological order.
facet dict Metadata on the facet the data came from. Can include things like provenance, measurement method, and units.

Examples

Example 1: Get the time series for a given variable and entity from a preferred facet.

Get the mean rainfall (DCID: Mean_Rainfall ) for New Delhi, India (DCID: wikidataId/Q 987).

Request:

$ curl --request GET --url \
'https://api.datacommons.org/v1/observations/series/wikidataId/Q987/Mean_Rainfall?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI'

Response:

{
  "observations": [
    {
      "date": "1901-01",
      "value": 1.13871
    },
    {
      "date": "1901-02",
      "value": 0.487143
    },
      
    <... output truncated for brevity ...>
 
    {
      "date": "2022-02",
      "value": 1.07331
    },
    {
      "date": "2022-03"
    }
  ],
  "facet": {
    "importName": "NOAA_EPA_Observed_Historical_Weather",
    "provenanceUrl": "https://www.noaa.gov/",
    "measurementMethod": "NASAGSOD_NASAGHCN_EPA",
    "unit": "Millimeter"
  }
}