Skip to content

Custom APIs#

Let's start with connecting a very simple API. There is a fantasy football API available here: https://www.fantasyfootballdatapros.com/api/players/2019/1.

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 earlier instructions about connecting 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 be descriptive of what the API is. It also should only contain 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:

SELECT *
FROM github.repos

SELECT *
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 in the screenshot below.

Adding an Endpoint

Once you've done that, save your work and you are ready to query!

Querying Your APIs#

Now that you've added your data, you can query your data. In the query view, 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 the one below:

SELECT *
FROM fantasyfootball.players