Query a canvas dataset
import requests
url = "https://platform.ankra.app/api/v1/org/canvas-datasets/{dataset_id}/query"
payload = { "time_range": {
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({time_range: {from: '2023-11-07T05:31:56Z', to: '2023-11-07T05:31:56Z'}})
};
fetch('https://platform.ankra.app/api/v1/org/canvas-datasets/{dataset_id}/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/canvas-datasets/{dataset_id}/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"time_range": {
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
}
}
'{
"state": "ok",
"observed_at": "<string>",
"source": "<string>",
"query_description": "<string>",
"reason": "<string>",
"series": [
{
"name": "<string>",
"points": [
[
123
]
]
}
],
"rows": {
"columns": [
{
"key": "<string>",
"label": "<string>",
"unit": "<string>"
}
],
"items": [
{}
]
},
"value": {
"number": 123,
"unit": "<string>"
},
"statuses": [
{
"label": "<string>",
"state": "<string>",
"detail": "<string>"
}
],
"truncated": true,
"histogram": {
"series": [
{
"key": "<string>",
"label": "<string>",
"tone": "neutral"
}
],
"buckets": [
{
"start": 123,
"end": 123,
"values": {}
}
],
"overlay": {
"label": "<string>",
"points": [
[
123
]
],
"unit": "<string>"
},
"gaps": [
{
"start": 123,
"end": 123
}
]
},
"previous": {
"state": "ok",
"observed_at": "<string>",
"source": "<string>",
"query_description": "<string>",
"reason": "<string>",
"series": [
{
"name": "<string>",
"points": [
[
123
]
]
}
],
"rows": {
"columns": [
{
"key": "<string>",
"label": "<string>",
"unit": "<string>"
}
],
"items": [
{}
]
},
"value": {
"number": 123,
"unit": "<string>"
},
"statuses": [
{
"label": "<string>",
"state": "<string>",
"detail": "<string>"
}
],
"truncated": true
}
}{
"detail": "<string>"
}{
"detail": "<string>"
}Canvas Datasets
Query a canvas dataset
Runs one dataset for a time range, pinned to the caller’s organisation and project, and with compare_previous also for the period of the same length just before it. Series are capped at 20 with at most 1000 points each and tables at 500 rows; truncated says when a cap applied.
POST
/
api
/
v1
/
org
/
canvas-datasets
/
{dataset_id}
/
query
Query a canvas dataset
import requests
url = "https://platform.ankra.app/api/v1/org/canvas-datasets/{dataset_id}/query"
payload = { "time_range": {
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({time_range: {from: '2023-11-07T05:31:56Z', to: '2023-11-07T05:31:56Z'}})
};
fetch('https://platform.ankra.app/api/v1/org/canvas-datasets/{dataset_id}/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/canvas-datasets/{dataset_id}/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"time_range": {
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
}
}
'{
"state": "ok",
"observed_at": "<string>",
"source": "<string>",
"query_description": "<string>",
"reason": "<string>",
"series": [
{
"name": "<string>",
"points": [
[
123
]
]
}
],
"rows": {
"columns": [
{
"key": "<string>",
"label": "<string>",
"unit": "<string>"
}
],
"items": [
{}
]
},
"value": {
"number": 123,
"unit": "<string>"
},
"statuses": [
{
"label": "<string>",
"state": "<string>",
"detail": "<string>"
}
],
"truncated": true,
"histogram": {
"series": [
{
"key": "<string>",
"label": "<string>",
"tone": "neutral"
}
],
"buckets": [
{
"start": 123,
"end": 123,
"values": {}
}
],
"overlay": {
"label": "<string>",
"points": [
[
123
]
],
"unit": "<string>"
},
"gaps": [
{
"start": 123,
"end": 123
}
]
},
"previous": {
"state": "ok",
"observed_at": "<string>",
"source": "<string>",
"query_description": "<string>",
"reason": "<string>",
"series": [
{
"name": "<string>",
"points": [
[
123
]
]
}
],
"rows": {
"columns": [
{
"key": "<string>",
"label": "<string>",
"unit": "<string>"
}
],
"items": [
{}
]
},
"value": {
"number": 123,
"unit": "<string>"
},
"statuses": [
{
"label": "<string>",
"state": "<string>",
"detail": "<string>"
}
],
"truncated": true
}
}{
"detail": "<string>"
}{
"detail": "<string>"
}Authorizations
Body
application/json
Response
The query ran. Its state says whether data came back: ok, empty, stale, unavailable (the source could not be read or did not answer within 10 seconds; reason says why) or denied (the cluster named in params is not visible to the caller).