Improve this doc

Data API v1.0 examples

Fork me on GitHub

The data can be queried programmatically through our API. Feel free to experiment the current features and report your user experience through our Feedback system. The awesome Socrata API has been inspiring our design, so that there's an almost total compatibility between the two. Stay tuned - more functionality is on its way!

API endpoint

/api/​v1/​datagem/​{datagemId|datagemSlug}/​data.{outputFormat}

You can obtain the datagem ID by clicking on the "Get API" button on the datagem page.

Output format

Format Description
json An array that contains N members according to the number of results retrieved by the query. In the response header you can find some useful information about itself, for example the number of results (X-DL-Count) and the dataset version (X-DL-datagem-version). Each member is a JSON object containing all key-values pairs corresponding to all columns present in the datagem
api Pretty interface for using the API, the full response, comprehensive of headers, is displayed in a dedicated styled page

Case sensitivity

It's simple: all the operations on strings are case insensitive. There's no difference between searching for "italy" or "Italy".

Parameters

Composites

Some datagem fields contain more than one value. For example in the Places datagem the municipality field contains both the name and the acheneID of the municipality. We call these fields composites. "municipality" is the composite root, while "name" and "acheneID" are called composite fields.

You can access composite fields using dot notation: in the above example, you can filter on "municipality.name" and "municipality.acheneID" (but not on "municipality" itself).

In $select, you can get the whole composite using the composite root, or just a field using dot notation.

Field functions

Note that field functions produce new columns with their result. The column name is arbitrary set by the API but it is possible to set a custom name by using the AS keyword

Filter functions

Response Code

Code range Description
200 - 299 The request was successful
400 - 499 The request failed because there was something wrong with the request
500 - 599 The request failed because there is a problem on the server. Our fault!

All 4xx error codes are associated with a JSON response, that contains:

Parameter Description
message a specific error message, that suggests the cause of the error
code the internal error code that the API return
data object with additional error information
error "true"

Limits

The V1 API have no specified requests limit. You are nonetheless invited to throttle your requests so that the service remains responsive for everyone. Anyway there’s a limit on the number of maximum elements that an API response can return, currently set to 100000. Please use pagination if you need to retrieve more elements.