Skip to content

Custom APIs#

Let's start with connecting this simple Fantasy Football API:

This API returns fantasy football players for a given year. The data is returned in JSON format and is completely static.

Connecting to an API#

Let's look at how you could connect this API to DataDistillr. First, follow the section on how to connect to a data source. When you get to the window to choose the data source type, select API as shown below.

Select API from the available choices

DataDistillr comes prepopulated with API configurations for popular APIs such as ServiceNow, SalesForce, Google Analytics and others. In our case, we will need to select Custom API, as shown below.

Select Custom API

Name Your Connection#

The next step is to give your connection a unique name. This name will appear in queries and should describe what the API is and only include alphanumeric characters and underscores.

Understanding DataDistillr's API Namespaces#

Once you have created your connection, DataDistillr allows you to define endpoints for the API. This may seem silly for an API with only one option, but consider something like GitHub or a banking API. There are likely multiple datasets which you'd like to access. Defining multiple endpoints per connection allows you to have logical, clean queries.

For example, let's say that you wanted to connect to GitHub's API, which has datasets for accessing repositories, organizations, people and more. By defining multiple endpoints, you will end up with queries like this:

FROM github.repos

FROM github.orgs

For our example here, give your API a name, and then click on the Add button by the endpoints, as shown below.

Add your API

Adding an Endpoint#

Now you are ready to add an endpoint to your API connection. For our simple example, the only fields you will need to fill out are the endpoint name, the URL, the request method (GET), and the data format, as shown below.

Adding an Endpoint

Now, click Save and you are ready to query!

Querying Your APIs#

Now that you've added your data, you can query your data. In the query editor, you will see your endpoint listed, but if you want to type in a query, or use this endpoint in a pre-existing query, you can run a query like this:

FROM fantasyfootball.players