Execute an NQL

Execute NQL queries and retrieve data in JSON or CSV format

Execute an NQL V1

post

Executes an NQL query and returns the results.

Authorizations
Header parameters
AuthorizationstringOptional
Acceptstring | nullableOptional

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.

Example: application/json
Body
queryIdstring · min: 1 · max: 255Required

Identifier of the query which is going to be executed.

Example: #my_query_idPattern: ^#[a-z0-9_]{2,255}$
Responses
200

OK - Successful execution.

post
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": [
    [
      {}
    ]
  ]
}

Execute an NQL V2

post

Executes an NQL query and returns the results.

Authorizations
Header parameters
AuthorizationstringOptional
Acceptstring | nullableOptional

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.

Example: application/json
Body
queryIdstring · min: 1 · max: 255Required

Identifier of the query which is going to be executed.

Example: #my_query_idPattern: ^#[a-z0-9_]{2,255}$
Responses
200

OK - Successful execution.

post
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?