An introduction to the Automation API

Edited

Access to the Automation API depends on your plan and your options. Check your Plans page to have a full overview about the plans.

If you're already familiar with APIs and the Automation API, you can go directly to the Automation API v1 documentation. Otherwise, read on for more details.

An API, or Application Programming Interface, is a tool designed to allow different software systems to communicate with each other. Opendatasoft provides several different APIs to interact with the platform, but Opendatasoft's Automation 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.

What the Automation API allows you to do

Opendatasoft's Automation API allows you to perform all of the actions available in a workspace's back office. Below is a non-exhaustive list of those actions:

  • Add data to Opendatasoft: Connect to your remote services, harvest another portal of federate Opendatasoft Hub.

  • Enrich your data: Describe your datasets using metadata, or add one of the many available data processors.

  • Publish your data: Publish a dataset on your portal, manage update schedules to keep your data fresh.

  • Handle your pages: Create and manage Studio and Code editor pages.

  • Manage your domain: Handle users and groups.

If you were a user of the Management API v2, it will be deprecated in the coming months and replaced by the Automation API, since the latter is more powerful and will offer more features:- New connectors (Sharepoint, Google Drive, Azure Blob Storage, Amazon S3 etc.)- Saved connections management- Federation from Opendatasoft Hub datasets- Metadata templates

Authenticating to the API

Using the Automation API requires you to be authenticated as an Opendatasoft user. Two options are possible:

  1. An API key in the query's header (recommended).
    API headers are like an extra source of information for each API call you make. Their job is to contain the meta-data associated with an API request and its response. To use this, provide an API key that exists for your Opendatasoft workspace in the "Authorization" headers, as follows: apikey<yourapikey>

  2. An API key in the query string (not as secure), as in: <your query>?apikey=<yourapikey>

Note that Basic Authentication can no longer be used.

Interacting with the API

So, how do you actually go about using the API? As we saw above, using the API consists of asking it for something, and getting an answer in return. In API-speak, you make a "call" or "request" and receive, in this case, a JSON object in return.

So when you use the API, your API call is sent to the Opendatasoft server, and is answered with a JSON object.

You'll want to use other tools to make interacting with the API more practical and useful. For example, API calls can be made using platforms such as Postman that are made to interact with APIs. If you're a developer, you can use Curl or Python's Requests library.

It's easy to see this in action in your own workspace. For example, the API can be asked to give you a list of all of the existing datasets. In your browser, enter:https://<yourdomainid>.opendatasoft.com/api/automation/v1.0/datasets?apikey=<yourapikey>.Replace the <yourdomainid> and <yourapikey> variables with the appropriate values. (See here for more information about generating API keys.)What you should see is a JSON object containing a list of your domain's datasets, with links to further JSON objects. That's the API in action! Of course, on its own, this isn't very interesting. But used with other tools, the API can be a powerful way of interacting with your data.

What next?

Hopefully this page helps explain how the Automation API can be useful to you.

No doubt using an API isn't for everyone. But with a little work, the API can allow you to easily publish data on your portal.

To assist you along the way, we invite you to dive into our documentation for the for the Automation API v1.