Query

Create query

POST
Create and enqueue the execution of a SQL query

Request

This endpoint expects an object.
query
stringRequired
The SQL query
datasetId
stringRequired
The id of the dataset to query

Response

This endpoint returns an object
createdUserId
string
The user that created the resource
createdDt
datetime
The created datetime of the resource
updatedUserId
string
The user that last updated the resource
updatedDt
datetime
The datetime the resource was last updated
queryId
string
The query id
query
string
The SQL query
datasetId
string
The dataset id
status
enum
The current status of the query
startDt
datetimeOptional
The time the query started executing
endDt
datetimeOptional
The time the query finished executing
isActive
booleanOptional
Defines if the query is in an active state or not
POST
1curl -X POST https://app.coactive.ai/api/v1/queries \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "query": "select * from coactive_images_table",
6 "datasetId": "c40276f0-024b-4a3f-b3e6-dcf0d304843e"
7}'
200
Successful
1{
2 "createdUserId": "user_example",
3 "createdDt": "2018-09-11T15:11:45.456777",
4 "updatedUserId": "user_example",
5 "updatedDt": "2018-09-11T15:11:45.456777",
6 "queryId": "57552f03-87af-4847-a83e-e46a320af0c2",
7 "query": "select * from coactive_images_table",
8 "datasetId": "c40276f0-024b-4a3f-b3e6-dcf0d304843e",
9 "status": "Running",
10 "startDt": "2018-09-11T15:11:45.456777",
11 "endDt": "2018-09-11T15:11:48.456777",
12 "isActive": false
13}