Execute an NQL
Execute NQL queries and retrieve data in JSON or CSV format
Executes an NQL query and returns the results.
Set the header to application/json for a JSON response or text/csv for a CSV response. If no value is set, application/json applied by default. Otherwise, 406 error (not acceptable) is returned.
application/jsonSet the header to true for UTC timezone. With any other value, regional timezone is applied by default.
trueOptional free-text tag, up to 255 characters, that can be added to the request. Nexthink stores the tag in the platform logs. The tag helps to categorize requests, and to filter and analyze them in logs and in dashboards. If the tag is longer than 255 characters, a 400 error is returned.
daily-device-reportIdentifier of the query which is going to be executed.
#my_query_idPattern: ^#[a-z0-9_]{2,255}$OK - Successful execution.
Identifier of the executed query
Final query executed with the replaced parameters.
Number of rows returned
Ordered list with the headers of the returned fields.
List of rows with the data returned by the query execution.
Bad request - Including a query that timed out because it was too expensive to run within the time budget, or the x-platform-log-custom-tag header is longer than 255 characters.
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 the header to application/json for a response or text/csv for a CSV response. If no value is set, application/json is applied by default. Otherwise, 406 error (not acceptable) is returned.
application/jsonSet the header to true for UTC timezone. With any other value, regional timezone is applied by default.
trueOptional free-text tag, up to 255 characters, that can be added to the request. Nexthink stores the tag in the platform logs. The tag helps to categorize requests, and to filter and analyze them in logs and in dashboards. If the tag is longer than 255 characters, a 400 error is returned.
daily-device-reportIdentifier of the query which is going to be executed.
#my_query_idPattern: ^#[a-z0-9_]{2,255}$OK - Successful execution.
Identifier of the executed query
Final query executed with the parameters replaced
Number of rows returned
Date and time of the execution in ISO format
2023-03-07T15:56:02Bad request - Including a query that timed out because it was too expensive to run within the time budget, or the x-platform-log-custom-tag header is longer than 255 characters.
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"
}
]
}Last updated
Was this helpful?

