Fetch Cursor

Fetchs the result of a specified query.

Required Permissions

Requires the MEMBER role or higher.

HTTP Request

GET /api/sonar/cursors/:id
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     "https://HOSTNAME/api/sonar/cursors/109?offset=0&limit=10"
Request Parameters
KeyRequiredTypeDescriptionNote
idO32-bit integerLogpresso query ID
offsetX64-bit integerNumber of records to skipMinumum: 0. Default: 0.
limitX64-bit integerMaximum number of records to loadMinimum: 0. Default: 1000.
formatXStringOutput formatOne of the following: html, txt, xml, csv, json, json-single.

Success Response

Below is an example of a response from the system tables | fields table query. If format is not specified, it is returned in newline-delimited JSON format.

\{"table":"sonar_event_00001"}
{"table":"sonar_raw_event_00001"}

If you specify the offset equal to or greater than the total number of query results, nothing will be retrieved. offset value must be smaller than the rows value from Get Query Status.

Error Responses

Failed to fetch a specified cursor

HTTP status code 403. If the query does not exist or is executed by another user account, you can't fetch the cursor.

{
    "error_code": "invalid-query-id",
    "error_msg": "cannot access query 42"
}
Query ID is not an integer

HTTP status code 400

{
    "error_code": "invalid-param-type",
    "error_msg": "query id should be integer type"
}
offset or limit value is not an integer

HTTP status code 400

{
    "error_code": "invalid-argument",
    "error_msg": "offset should be long type."
}
offset or limit value is negative

HTTP status code 400

{
    "error_code": "invalid-argument",
    "error_msg": "offset should be non-negative integer."
}
Invalid format value

HTTP status code 400

{
    "error_code": "invalid-argument",
    "error_msg": "format should be one of html, txt, xml, csv, json or json-single."
}