Using APIs in Opendatasoft

Edited

An API (Application Programming Interface) is an interface for programs to communicate and exchange data. If you want to use data stored somewhere online, an API allows you to interact with that data in a way the source will understand. And if you want to share your data with others, an API allows you to define what kind of access they have.

To know more about what APIs are and why and how they are used, you can read the article "You don't need analogies to understand APIs" written by one of our Opendatasoft developers.

Opendatasoft provides access to five APIs:

  • ODS Explore API V2: This is the main Opendatasoft API, used to explore catalogs and datasets with a custom SQL-like query language: ODSQL. The Explore API gives you access to public data on the Opendatasoft platform. For more information, see An introduction to the Explore API, or skip straight to the Explore API documentation.

  • Automation API: This API can be very useful to automate your data governance processes and make sure the data published on your portal is always up to date. See An introduction to the Automation API for more information, or else go straight to the Automation API documentation.

  • WFS and CSW are standards focusing on geographic data. See here for an introduction to WFS, or else go straight to the WFS documentation. They are especially relevant, for example, to interface the platform with other GIS software

  • OData is a standard for REST APIs that provides a common language to be used across APIs to perform requests. The trade-off for this norm's generic approach is its higher complexity compared to traditional custom REST APIs. Opendatasoft has implemented this norm for the simple operations (searching for datasets and records); for the more complex ones (analysis, aggregations, geographic computations, etc.), use our Explore API V2.

  • Triple Pattern Fragments API: This is an ODS API for triple pattern querying over datasets from Opendatasoft portals. It enables dataset querying in Resource Description Framework (RDF) format. See the Triple Pattern Fragments (TPF) API documentation.

All of these APIs provide access to any data pushed on the platform, regardless of source or format, as long as the security rules defined by owner of that data allow you to have that access.

These APIs can be used, for example, to search for datasets and data, to compute analysis, or to perform geographic aggregations, or even to allow third parties to reuse data on your portal. Some Opendatasoft customers have seen datasets they provide used to create applications. For example, "Qui dit miam !" and "Y'A D Frites!" are two applications that display the school lunch menus in the French cities of Toulouse, Rennes, and Saint-Malo, based on data provided on Opendatasoft portals.

How Opendatasoft data is structured

Before using any of the available APIs, it is very important to be familiar with the way the data is structured. Everything within the Opendatasoft platform is built according to a tree structure (there are more types of data within the platform, but they are only relevant in very specific contexts).

The Opendatasoft platform can be seen as a network of Opendatasoft portals. A portal provides a catalog of all of its datasets. Each dataset is defined by a dictionary of metadata, a data schema (specifying fields names and types), and a collection of records. Each record provides values for each of the dataset's fields.