Skip to main content
POST
/
v1
/
datasets
/
query
/
execute
/
{dataset_id}
Query a DataSet
curl --request POST \
  --url https://api.domo.com/v1/datasets/query/execute/{dataset_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "sql": "SELECT * FROM table"
}
'
{
  "datasource": "ce79d23f-ef7d-4318-9787-ebde54a8c5b4",
  "columns": [
    "Description",
    "% of Inventory Value",
    "Cost",
    "Total Inventory Value",
    "_BATCH_ID_",
    "_BATCH_LAST_RUN_"
  ],
  "metadata": [
    {
      "type": "STRING",
      "dataSourceId": "ce79d23f-ef7d-4318-9787-ebde54a8c5b4",
      "maxLength": -1,
      "minLength": -1,
      "periodIndex": 0
    },
    {
      "type": "DOUBLE",
      "dataSourceId": "ce79d23f-ef7d-4318-9787-ebde54a8c5b4",
      "maxLength": -1,
      "minLength": -1,
      "periodIndex": 0
    },
    {
      "type": "LONG",
      "dataSourceId": "ce79d23f-ef7d-4318-9787-ebde54a8c5b4",
      "maxLength": -1,
      "minLength": -1,
      "periodIndex": 0
    },
    {
      "type": "LONG",
      "dataSourceId": "ce79d23f-ef7d-4318-9787-ebde54a8c5b4",
      "maxLength": -1,
      "minLength": -1,
      "periodIndex": 0
    },
    {
      "type": "DOUBLE",
      "dataSourceId": "ce79d23f-ef7d-4318-9787-ebde54a8c5b4",
      "maxLength": -1,
      "minLength": -1,
      "periodIndex": 0
    },
    {
      "type": "DATETIME",
      "dataSourceId": "ce79d23f-ef7d-4318-9787-ebde54a8c5b4",
      "maxLength": -1,
      "minLength": -1,
      "periodIndex": 0
    }
  ],
  "rows": [
    [
      "Maintenance",
      0.0035,
      35000,
      10000000,
      410,
      "2019-03-19T18:49:02"
    ],
    [
      "Labor",
      0.007,
      70000,
      10000000,
      410,
      "2019-03-19T18:49:02"
    ],
    [
      "Utilities",
      0.0087,
      87000,
      10000000,
      410,
      "2019-03-19T18:49:02"
    ],
    [
      "Space",
      0.025,
      250000,
      10000000,
      410,
      "2019-03-19T18:49:02"
    ]
  ],
  "numRows": 4,
  "numColumns": 6,
  "fromcache": true
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

dataset_id
string
required

Body

application/json
sql
string
required

Response

200 - application/json

Returns data from the DataSet based on your SQL query.

datasource
string
columns
string[]
metadata
object[]
rows
string[]
numRows
integer
numColumns
integer
fromcache
boolean