Skip to main content

API

Any Infer account has the ability to connect to Infer and execute commands using the Infer REST API.

The first thing you need to do is get your API credentials and familiarise yourself with how to call the API.

Getting your API Credentials

Login to your Infer account: https://app.getinfer.io/

Click on your profile in the top right corner and then "Account Settings".

Inside "Account Settings" click "Generate" in the "API Token" section. This will generate a new API token. Copy-paste it.

Your credentials to the API will be your login email and the API token.

Calling the API

Using your credentials you can access the API as a standard REST API using POST, PUT and GET commands.

When calling the API make sure to include your credentials in the header in the following way

Authorization: Token token="APITOKEN", email=account@email
Content-Type: application/json

Working with Datasets

Creating a dataset from encoded data

Type POST

URL https://api.getinfer.io/api/v1/datasets/

Input Example

    {
"dataset": {
"name": "table_name",
"description": "This is an upload test",
"source_file": {
"data": "BASE64ENCODEDCSV",
"filename": "filename.csv"
}
}
}

Creating a dataset an S3 file

Type POST

URL https://api.getinfer.io/api/v1/datasets/

Input Example

    {
"dataset": {
"name": "table_name",
"description": "This is an upload test",
"source_file": {
"url": "https://path.to/data.csv",
"filename": "filename.csv"
}
}
}

List all available datasets

Type GET

URL https://api.getinfer.io/api/v1/datasets/

Update a dataset

Type PUT

URL https://api.getinfer.io/api/v1/datasets/{id}

Input Example

{ "dataset": {"name": "updated_name"} }

Run an SQL-inf command

Type POST

URL https://api.getinfer.io/api/v1/datasets/{dataset_id}/results

Input Example

{
"result": {
"name": "Explain predict",
"query": "SELECT * FROM table_name EXPLAIN(PREDICT(column))"
}
}

Get the results of a run

Type GET

URL https://api.getinfer.io/api/v1/results/{result_id}

Parse and SQL-inf command

Type POST

URL https://api.getinfer.io/api/v1/parse

Input Example

{
"q": "SELECT * FROM companies PREDICT(churn)"
}

Syntax check of SQL-inf command against data set

Type POST

URL https://api.getinfer.io/api/v1/datasets/{dataset_id}/parse

Input Example

{
"q": "SELECT * FROM companies PREDICT(churn)"
}