Output Formats

The Socrata Open Data API supports a number of different response formats that can be specified either via response type extensions on the API endpoint or HTTP Accept headers.

Format Extension Mime Type Availability »
CSV csv text/csv; charset=utf-8 2.0 and 2.1
GeoJSON geojson application/vnd.geo+json;charset=utf-8 2.1
JSON json application/json;charset=utf-8 2.0 and 2.1
RDF-XML rdf application/rdf+xml; charset=utf-8 2.0
XML xml text/xml; charset=utf-8 2.0

Neither type is better than the other - simply select the one that works best for your framework and application.

Extensions

The simplest way to specify the response format is by appending an response type extension to the URL. This allows you to set the response format without requiring the ability to set headers in your HTTP client.

Simply add the extension to the endpoint. For example, if your resource endpoint is /resource/644b-gaut, and you wanted to get CSV output, your path would be /resource/644b-gaut.csv.

HTTP Accept Headers

HTTP Accept headers allow applications to automatically negotiate content types with a web service. With SODA, this also means you can request content types using Accept headers without needing to provide an response type extension.

Simply send an Accept header along with the desired mimetype for the desired response type. For example, to request JSON, you’d use a header of Accept: application/json.

The SODA API response will also include a Content-type header to specify the format of the data that it is returning.