For the sophisticated operator who wants to query raw data, the AskTreez Data API is here to fill that niche. Powered by a BI (Business Intelligence) Tool called DOMO, Treez is able to easily administer data in a flexible JSON file so you can freely create your own custom reports.
This page will help you get started with using our Data API. If you have questions about the data or your access, please contact asksupport@treez.io and one of our support agents will assist you promptly.
For a comprehensive understanding of the technical requirements or limitations of the API check out Domos Developer docs and the Developer API Explorer – a great resource for testing the API!
Access
In order to access our API, first request a CLIENT ID and CLIENT SECRET from partners@treez.io, and our Business Development team will start the process of qualifying your organization.
Next, all users must be authenticated (prove that they are who they say they are) using their CLIENT ID and CLIENT SECRET. Once a user has been authenticated, they will be issued an Access Token which is required to authorize their read-only data scope.
Domo Curls
Authorization Curl
$ curl -v -u {CLIENT_ID}:{CLIENT_SECRET} "https://api.domo.com/oauth/token?grant_type=client_credentials&scope=data"
.CSV Data Dump Curl
curl -v -A "Mozilla/4.0" -H 'Accept: text/csv' -H "Authorization: Bearer {ACCESS_TOKEN}" "https://api.domo.com/v1/datasets/{Dataset_ID}/data?includeHeader=true&fileName=data-dump.csv"
Additional Curl Resources can be found here.
Primary API Requests
Our Data API has a large array of Request Endpoints that can be called, however you really only need 3 to get started:
- Get Authenticated using the ‘Authentication’ Endpoint
- Request your datasets using the ‘Retrieve Datasets’ Endpoint
- Write A SQL Query to request a JSON file of data using the ‘Query Dataset’ Endpoint
You can watch this video for a quick walkthrough of requesting these APIs using Postman: https://youtu.be/rvc4B5nUcZw
Get Authenticated
GET https://api.domo.com/oauth/token?grant_type=client_credentials&scope=data Accept: Application/JSON Authorization: Basic Auth [Username = CLIENT ID, Password = CLIENT SECRET] Sample Response: |
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiUGFydGljaXBhbnQiLCJzY29wZSI6WyJkYXRhIl0sImRvbWFpbiI6InRyZfaf7KDoSQexiwiZXhwIjoxNjEyNDgxMDAxLCJlbnYiOiJwcm9kOSIsInVzZXJJZCI6NzU2NjE4Njc2LCJqdGkiOiJvSFBBclNXSlliT1czc3I2bU10WllJcjRMK1E9IiwiY2xpZW50X2lkIjoiYmFjNDhkZTAtNzYxNC00kld8oPiOWItNTNkOTA4MDcwMGM4IiwiY3VzdG9tZXIiOiJtbW1tLTAwMDktNjY4NyJ9.nO2CtqPP7pB8xC1i2WnXLHpMY_EghDwGp4KjW1_1sclpih_mYumxsYdCZu1uxRAgdy5WiW9nQcQQvyDc1gzy2JZ8ASflUx4Oecv-KC-vm_ioIqvZ2TfXCuHt53Ad7d-6cljD9ar6tAefocBhOqjWyuREPJOMWTF1F84KF5kVWKKSw7KWx06Gc6tiS06kRhhX0fYgAwDJG4WSI6RaT_Na56Y2jg89Du4SZevIuv5bsSsrcBpragJY8evqj4TVIb_0ieJPBkNYaAJT09NnveVLXYKxO9RhdppBqMuGVh6HdgTWmBZERiei-LcOMAaR-54068grTe1OYtlsV9e2uhqojw",
"token_type": "bearer",
"expires_in": 3599,
"scope": "data",
"customer": "mmmm-0009-6687",
"env": "prod9",
"userId": 42068420,
"role": "Participant",
"domain": "treez-io.domo.com",
"jti": "oJKorSWJYbOW3sr6mM7uIIr4L+Q="
}
Request Your Datasets
GET https://api.domo.com/v1/datasets/ Accept: Application/JSON Authorization: Bearer <your-valid-oauth-access-token> Sample Response: |
[{"id": "9a2b95e9-9184-4e5f-a505-1b33df0427c5",
"name": "Dataset_Demo",
"description": "Fake Grades",
"rows": 16,
"columns": 9,
"owner": {
"id": 518785304,
"name": "Sheldon Playdle"
},
"dataCurrentAt": "2021-02-04T17:59:37Z",
"createdAt": "2021-02-04T17:59:30Z",
"updatedAt": "2021-02-04T17:59:38Z",
"pdpEnabled": false
},
{"id": "fb3efdee-3aea-58e1-849e-7880w35aae80",
"name": "MARKET - FLOW",
"rows": 76552217,
"columns": 122,
"owner": {
"id": 797328204,
"name": "Graham Arnold"
},
"dataCurrentAt": "2021-02-04T12:43:53Z",
"createdAt": "2020-04-03T16:39:10Z",
"updatedAt": "2021-02-04T12:43:53Z",
"pdpEnabled": true
}]
Query Datasets
POST https://api.domo.com/v1/datasets/query/execute/{Dataset_ID} Accept: Application/JSON Authorization: Bearer <your-valid-oauth-access-token> Request Body: {"sql": "SELECT * FROM retail_tickets"} Data Type: raw Content Type: JSON Sample Response: |
{
"datasource": "9a2b95e9-9184-4e5f-a505-1b33df0427c5",
"columns": [
"Last name",
"Test1",
"Grade"
],
"metadata": [
{
"type": "STRING",
"dataSourceId": "9a2b95e9-9184-4e5f-a505-1b33df0427c5",
"maxLength": -1,
"minLength": -1,
"periodIndex": 0,
"aggregated": false
},
{
"type": "DOUBLE",
"dataSourceId": "9a2b95e9-9184-4e5f-a505-1b33df0427c5",
"maxLength": -1,
"minLength": -1,
"periodIndex": 0,
"aggregated": false
},
{
"type": "STRING",
"dataSourceId": "9a2b95e9-9184-4e5f-a505-1b33df0427c5",
"maxLength": -1,
"minLength": -1,
"periodIndex": 0,
"aggregated": false
},
],
"rows": [
[
"Alfalfa",
47,
"F"
],
[
"Alfred",
96,
"A"
],
[
"Gerty",
74,
"C"
],
[
"Android",
82,
"B-"
]
],
"numRows": 4,
"numColumns": 3,
"fromcache": true
}
Comments
0 comments
Article is closed for comments.