Execute an NQL
Execute NQL queries and retrieve data in JSON or CSV format
Executes an NQL query and returns the results.
Set it to application/json for a JSON response, text/csv for a CSV response. If no value is set, application/json is used by default. Otherwise a 406 error (not acceptable) is returned.
application/json
Identifier of the query which is going to be executed.
#my_query_id
Pattern: ^#[a-z0-9_]{2,255}$
OK - Successful execution.
Unauthorized - No valid authentication credentials.
No permission - Not authorized to execute queries.
Not found - No query associated with that ID.
Not Acceptable. The Accept header should be "application/json", "text/csv" or empty.
Internal server error.
Service unavailable.
POST /api/v1/nql/execute HTTP/1.1
Host: instance.api.region.nexthink.cloud
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 111
{
"queryId": "#my_query_id",
"parameters": {
"parameterName1": "parameterValue1",
"parameterName2": "parameterValue2"
}
}
{
"queryId": "text",
"executedQuery": "text",
"rows": 1,
"executionDateTime": {
"year": 1,
"month": 1,
"day": 1,
"hour": 1,
"minute": 1,
"second": 1
},
"headers": [
"text"
],
"data": [
[
{}
]
]
}
Executes an NQL query and returns the results.
Set it to application/json for JSON response, text/csv for CSV response. If no value is set, application/json is used by default. Otherwise a 406 error (not acceptable) is returned.
application/json
Identifier of the query which is going to be executed.
#my_query_id
Pattern: ^#[a-z0-9_]{2,255}$
OK - Successful execution.
Unauthorized - No valid authentication credentials.
No permission - Not authorized to execute queries
Not found - No query associated with that ID
Not Acceptable - The accept header should be "application/json", "text/csv" or empty
Internal server error
Service unavailable
POST /api/v2/nql/execute HTTP/1.1
Host: instance.api.region.nexthink.cloud
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 111
{
"queryId": "#my_query_id",
"parameters": {
"parameterName1": "parameterValue1",
"parameterName2": "parameterValue2"
}
}
{
"queryId": "text",
"executedQuery": "text",
"rows": 1,
"executionDateTime": "2023-03-07T15:56:02",
"data": [
{
"key1": "my-device",
"key2": "device-info"
}
]
}
Was this helpful?