Alli Data API
Using the API
In order to use the API, you will need an API client such as Postman or Restlet for Chrome.
Postman API Endpoint: Datawarehouse_categorization.postman_collection.json
All urls for the endpoints below with start with https://data.alliplatform.com
Authentication
Following the update to v2, the API is able to support the use of Alli Central access tokens for authentication.
This is documentation for the official way for individual users to get their tokens; This is for “Machine” credential tokens for applications to use. The v2 access tokens can also be obtained by going to your Central user profile (https://central.alliplatform.com/me) and using the browser's developer tools to view the request details for the /me
request.
Previously, the API access tokens for v1 were provided by a member of the Alli Data team or by one of the other members of the engineering team. Although v1 tokens will no longer be issued, they will continue to work with the API.
Once you have your API token, send it as the bearer authentication header in your API request. Authorization: Bearer [API CODE]
User Access
GET /api/:version/user/
Shows the user information and the available projects for that user
:version
is the api version (v1 or v2)
Response Body
{
"email": "chris.alvares@pmg.co",
"name": "Chris Alvares",
"projects": [
{
"name": "testclient",
"_id": "53853c06f0c78f1c5c3c0cea",
"createdAt": "2014-05-28T01:29:42.355Z"
},
{
"name": "jcrew",
"_id": "53860873867e1e1b128d6aac",
"createdAt": "2014-05-28T16:01:55.536Z"
},
{
"_id": "53d7cbeec0956756102d16cd",
"name": "travelocity",
"createdAt": "2014-07-29T16:29:34.031Z"
}
]
}
Listing DatasourceViews
GET /api/:version/viewlist/:client
Shows all DatasourceView names and their definitions for the supplied :client
.
DatasourceViews will be sorted by name
.
Response Body
[
{
"name":"clientname__dailytracker",
"definition":"select * from clientname__ga;",
"databaseType":"Redshift"
},
{
"name":"clientname__datespend",
"definition":"select date, sum(spend) from clientname__source group by date;",
"databaseType":"all"
}
]
Listing Datasources and DatasourceViews - Relations
GET /api/:version/relations
Shows all Datasources and DatasourceViews that a user has access to.
Response Body
Retrieving Data from a Relation
GET /api/:version/relations/stream/:entityid?type=:type
Returns csv data of the Datasource or DatasourceView.
:entityid
is the id of the Datasource or DatasourceView.
:type
is the type of the relation. It must be either Datasource or DatasourceView.
The response will have a header set describing the columns in the response body csv:
X-API-Meta -> {"columnTypes":["String","String"]}
Response Body
a,b1234,41325,-9898797
Fetching Datasources For a Project
GET /api/:version/project/:projectid/datasources
GET /api/:version/project/:projectid/datasources?limit=:limit&cursor=:cursor
Retrieves datasources for a project (client) which the API user has access.
Ordered starting from most recently created datasources
:projectid
is the id of the project(client) to retrieve the datasources for.
:limit
is the maximum number of datasources to retrieve.
OPTIONAL
1 <= limit <= 25
defaults to 10 if no limit is selected
defaults to 25 if the limit selected is larger than 25
:cursor
is the timestamp of the last retrieved datasource.
OPTIONAL
defaults to the current time if no cursor is selected
Requires an Origin header.
Example: https://data.allistaging.com/api/v2
Response Body
Fetching a Single Datasource
GET /api/:version/datasource/:datasourceid/fetch
Retrieves a single datasource to which the API user has access.
:datasourceid
is the id of the Datasource to retrieve.
Response Body
Delete Datasource data by date range
POST /api/:version/datasource/:datasourceid/delete
Delete datasource
:datasourceid
is the id of the Datasource to delete.
Date format is - mm/dd/yyy
Required fields:
startdate
,enddate
Request Body
Fetching a Single DatasourceView
GET /api/:version/datasourceview/:datasourceviewid/fetch
Retrieves a single datasource view to which the API user has access.
:datasourceviewid
is the id of the DatasourceView to retrieve.
Response Body
Datasource Run Information
GET /api/:version/project/:projectid/datasources/runinfo?date=YYYY-MM-DD&limit=:limit&page=:page
Gets the run information for a project’s datasources
Required:
:version
is the api version (v1 or v2).
:projectid
is the id of the project to access.
Query String Parameter(s):
date
is the day to get data for.
OPTIONAL
defaults to today if no date is selected
:limit
is the maximum number of datasources to retrieve.
OPTIONAL
1 <= limit <= 25
defaults to 10 if no limit is selected
defaults to 25 if the limit selected is larger than 25
:page
is the page number of datasources to retrieve.
OPTIONAL
0 <= page <= infinity
defaults to first page if no page is selected
Response Body
{
"status": "Success",
"datasourcesRunInfo": [
{
"_id": "24efhg",
"tags": [
""
],
"sourceType": "googleads",
"sourceStatus": 1,
"sourceSchedule": 1,
"parentDatasource": null,
"uploadStyle": 0,
"project": {
"timezone": "America/Chicago",
"_id": "rcytvuybi3",
"centralId": "3g3g2-3gv-2g53",
"name": "acme",
"createdAt": "2020-03-16T19:25:04.505Z"
},
"name": "evan_testing_googleads_insights_ad",
"description": "",
"createdBy": {
"email": "evan@pmg.com"
},
"createdAt": "2021-12-15T21:52:20.491Z",
"successMessages": [
{
"_id": "3nirp03t",
"name": "Data Loaded",
"message": "Data Loaded Successfully with 0 errors and 1 rows inserted",
"successType": "datasource",
"successId": "24efhg",
"rowsSuccessful": 1,
"rowsErrored": 0,
"rowsWarned": 0,
"startDate": "2023-03-08T12:58:02.963Z",
"dateOccured": "2023-03-08T12:58:03.283Z"
}
],
"errorMessages": [
{
"_id": "0nigr024g",
"name": "Google Ads Error for Account:...",
"message": "\"Error: unauthorized_client\"",
"errorType": "datasource",
"errorId": "24efhg",
"errorPriority": 30,
"dateOccured": "2023-03-08T12:58:03.283Z"
}
]
},
]
}
Programmatically executing a datasource
GET /api/:version/datasource/:datasourceid/sync
GET /api/v1/datasource/:datasourceid/sync?startdate=YYYY-MM-DD&enddate=YYYY-MM-DD
Automatically starts a datasource job within 5 minutes of execution. The 5 minute
period is to ensure jobs are not called multiple times within a 5 minute window.
If the api is called multiple times, the 5 minute timer restarts.
Response Body
{
"success":true,
"jobStartsAt": "Wed Feb 22 2017 22:42:52 GMT-0600 (CST)"
}
Creating a Datasource
POST /api/:version/project/:projectid/datasource/create
This endpoint will create a new datasource with the parameters included in the
request body.
Requirements:
The request body must include a name
for the new datasource, and a sourceType
that designates the type of datasource to create. Without a sourceType
, the created datasource will default to a manual upload.
the sourceType
might be a number for older datasources
Optional:
additionalConfiguration
object will populate the Additional Configuration Needed section of the created datasource. This object will vary by the created datasource type.
sourceSchema
object will add dimensions and metrics to the created datasource in addition to indexes.
sourceStatus
integer determines whether the datasource is Inactive (0), Active (1) or Archived (2).
tags
array will add tags to the created datasource.
Request and Response Body
Editing a Datasource
PATCH /api/:version/datasource/:datasourceid/edit
This endpoint will edit an existing datasource with the properties to be updated included in the request body.
Properties able to be updated:
tags
description
sourceStatus
sourceSchedule
sourceSchema
createdBy
- only for Machine credentials
Request Body
{
"tags": ["updated_tag_4"],
"description": "updated description"
}
Response Body
{
"status": "Success",
"datasource": {
"id": "632e126f12f9a500087d032d",
"tableName": "test_restrictions_bing",
"schemaName": "testing",
"projectId": "61a94f3e2de4d200080d43f3",
"name": "test_restrictions_bing",
"tags": [
"updated_tag_4"
],
"sourceType": "bing",
"sourceSchema": {
"columns": [
{
"name": "TimePeriod",
"type": "String"
},
{
"name": "DeviceOS",
"type": "String"
},
{
"name": "CustomerName",
"type": "String"
},
{
"name": "AllConversions",
"type": "Number"
},
{
"name": "AllRevenue",
"type": "Number"
},
{
"name": "Assists",
"type": "Number"
}
],
"indexes": [
{
"name": "Index1",
"type": "primary",
"columns": [
"TimePeriod",
"DeviceOS",
"CustomerName"
]
}
]
},
"createdAt": "2022-09-23T20:09:19.127Z",
"parentDatasource": null,
"columnValidations": {},
"uploadStyle": 0,
"createdBy": {
"id": "5e27cd15-5757-493a-8758-db90e5701687",
"email": "alicia.zavala@pmg.com"
},
"clientId": "3de0c863-85b4-4492-b12d-37b2a124c99a"
}
}
Creating a DatasourceView
POST /api/:version/project/:projectid/datasourceview/create
This endpoint will create a new datasource view with the parameters included in the
request body.
Requirements:
The request body must include a name
for the new datasourceview.
Optional:
report
object will populate the dimensions, metrics, datasources and filters applied in the report.
description
of the datasource.
isPublished
0 if not published and 1 otherwise.
Request and Response Body
List Categorizations
GET /api/:version/project/:projectid/categorizations/list
This endpoint will list the categorizations for a projectid.
:projectid
is the id of the project Id for the categorizations.
Response Body
Get a Single Categorization
GET /api/:version/categorization/:categorizationid/get
Gets a single categorization object
:categorizationid
is the id of the categorization to access.
Response Body
Add a Categorization
POST /api/:version/project/:projectid/categorizations/add
Adds a categorization to a project
Required:
name
name of the categorization.
Optional:
description
of the categorization.
inputFields
array of the fields listed in a categorization.
rules
array of rules for a categorization. each rule has a
where - contains a field, operator, value, sub statement type (currently only supports "and") and sub statements which can contain more field, operator and value types.
value - the value at which to assign the categorization rule
Operator Types:
Operators support:
Operator | Description |
---|---|
= | equals |
ilike | contains |
!= | not equals |
> | greater than |
< | less than |
>= | greater than or equal to |
<= | less than or equal to |
!ilike | does not contain |
like | contains case sensitive |
!like | does not contain case sensitive |
Request and Response Body
Edit a Categorization
POST /api/:version/categorization/:categorizationid/edit
Edits an existing categorization.
Optional:
description
of the categorization.
inputFields
array of the fields listed in a categorization.
rules
array of rules for a categorization. each rule has a
where - contains a field, operator, value, sub statement type (currently only supports "and") and sub statements which can contain more field, operator and value types.
value - the value at which to assign the categorization rule
Operator Types:
Operators support:
Operator | Description |
---|---|
= | equals |
ilike | contains |
!= | not equals |
> | greater than |
< | less than |
>= | greater than or equal to |
<= | less than or equal to |
!ilike | does not contain |
like | contains case sensitive |
!like | does not contain case sensitive |
Request and Response Body
Publish a Categorization
POST /api/:version/categorization/:categorizationid/publish
Publishes a categorization to the database.
Response Body
Delete a Categorization
POST /api/:version/categorization/:categorizationid/delete
Deletes a categorization and the database function.
Response Body
Publish a Authorization
POST /api/:version/auth/:categorizationid/publish
Publishes a categorization to the database.
Response Body
Delete a Categorization
POST /api/:version/categorization/:categorizationid/delete
Deletes a categorization and the database function.