Get Statistical Value for a Place

Returns a statistical value for a place based on the StatisticalVariable. See the full list of StatisticalVariables.

When there are multiple sources for the same statistical variable, a prefered source with more recent data or more authorative is selected.

URL: /stat/value

Method: GET

Required Arguments:

You can find a list of StatisticalVariables with human-readable names here.

Optional Arguments:

  • date: The preferred date of observation in ISO 8601 format. If not specified, returns the latest observation.
  • measurement_method: The dcid of the preferred measurementMethod value.
  • observation_period: The preferred observationPeriod value.
  • unit: The dcid of the preferred unit value.
  • scaling_factor: The preferred scalingFactor value.

GET Request

Example

curl 'https://api.datacommons.org/stat/value?place=geoId/06&stat_var=Count_Person_Male'

Success Response

Code: 200 OK

Response content example

{
    "value": 200
}

Error Response

Code: 400 Bad Request

Request example: (place not specified)

curl 'https://api.datacommons.org/stat/value?stat_var=Count_Person_Male'

Response content example

{
  "code": 3,
  "message": "Missing required argument: place"
}

Code: 404 Not Found

Request example: (No data for the query)

curl 'https://api.datacommons.org/stat/value?place=badPlaceDcid&stat_var=Count_Person_Male'

Response content example

{
  "code": 5,
  "message": "No data for badPlaceDcid, Count_Person_Male",
}