Datasets API endpoint
Returns city counts per country for the Numbeo cities dataset; `facet` is required and accepts only `country`. Narrow the counts with `q`, `country` and index thresholds such as `min_cost_of_living_index`, `min_safety_index` or `max_pollution_index`. Items are value and count pairs.
/datasets/numbeo-cities/facetsReturns terms aggregation counts for the Numbeo cities dataset, honoring the same filters as Search the Numbeo cities dataset.
Dataset id enum:
numbeo-citiesQuery parameters:
facet: required. Allowed values: country.q, country, min_cost_of_living_index, max_cost_of_living_index, min_quality_of_life_index, min_crime_index, max_crime_index, min_safety_index, min_health_care_index, max_pollution_index, max_traffic_index) also apply here.Response includes dataset, facet, items[] (value, count).
| Field | Filled in, of 50 checked | Values in the sample |
|---|---|---|
| value | 50 | |
| count | 50 | 4 to 212, median 8 |
| Parameter | Type | Required | Default | Description | Example |
|---|---|---|---|---|---|
| facet | string | Yes | Facet enum: country Allowed values: country. | country | |
| q | string | No | Full-text query over the city name, max 256 characters | ||
| country | string | No | Exact country filter, max 128 characters | ||
| min_cost_of_living_index | number | No | Minimum Cost of Living Index (New York = 100) | ||
| max_cost_of_living_index | number | No | Maximum Cost of Living Index (New York = 100) | ||
| min_quality_of_life_index | number | No | Minimum Quality of Life Index | ||
| min_crime_index | number | No | Minimum Crime Index | ||
| max_crime_index | number | No | Maximum Crime Index | ||
| min_safety_index | number | No | Minimum Safety Index | ||
| min_health_care_index | number | No | Minimum Health Care Index | ||
| max_pollution_index | number | No | Maximum Pollution Index | ||
| max_traffic_index | number | No | Maximum Traffic Index | ||
| x-api-key (header) | string | Yes | API key required |
curl -X GET "https://api.crawlora.net/api/v1/datasets/numbeo-cities/facets?facet=country&q=coffee&country=us" \ -H "x-api-key: $CRAWLORA_API_KEY"
{
"code": 200,
"msg": "OK",
"data": {
"dataset": "numbeo-cities",
"facet": "country",
"items": [
{
"value": "United States",
"count": 180
},
{
"value": "Germany",
"count": 42
}
]
}
}Request schema
No body schema
Response schema
#/definitions/datasets.numbeoCitiesFacetResponseDoc
| Field | Type | Required | Enum | Bounds | Example | Description |
|---|---|---|---|---|---|---|
| code | integer | No | 200 | |||
| data | datasets.NumbeoCityFacetResponse | No | ||||
| data.dataset | string | No | Identifier of the dataset queried (`numbeo-cities`). | |||
| data.facet | string | No | Facet that was aggregated. | |||
| data.items | array | No | Facet values with the number of matching records for each. | |||
| data.items[].count | integer | No | Number of records with this value. | |||
| data.items[].value | string | No | Facet value being counted. | |||
| msg | string | No | OK |
| Status | Description | Schema |
|---|---|---|
| 400 | Bad Request | #/definitions/app.Response |
| 429 | Too Many Requests | #/definitions/app.Response |
| 500 | Internal Server Error | #/definitions/app.Response |
Use environment variables for secrets and keep Crawlora API keys server-side.
curl -X GET "https://api.crawlora.net/api/v1/datasets/numbeo-cities/facets?facet=country&q=coffee&country=us" \
-H "x-api-key: $CRAWLORA_API_KEY"