Get results¶
GET/
XDR Query API · Runs
Get the paged results for a query run.
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
X-Tenant-ID | header | string (uuid) | No | Tenant ID. |
runId | path | string (uuid) | Yes | Query run ID. |
pageFromKey | query | string | No | The key of the item from where to fetch a page. |
pageSize | query | integer | No | The size of the page requested. |
page | query | integer | No | The page number to fetch, starting with 1. |
Request samples¶
curl -X GET "https://api-<data-region>.central.sophos.com/xdr-query/v1/queries/runs/<runId>/results" -H "Authorization: Bearer <access-token>" -H "X-Tenant-ID: <tenant-id>"
import requests
response = requests.get(
"https://api-<data-region>.central.sophos.com/xdr-query/v1/queries/runs/<runId>/results",
headers={
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
},
)
print(response.json())
$headers = @{
"Authorization" = "Bearer <access-token>"
"X-Tenant-ID" = "<tenant-id>"
}
Invoke-RestMethod -Method GET -Uri "https://api-<data-region>.central.sophos.com/xdr-query/v1/queries/runs/<runId>/results" -Headers $headers
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://api-<data-region>.central.sophos.com/xdr-query/v1/queries/runs/<runId>/results", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer <access-token>")
req.Header.Set("X-Tenant-ID", "<tenant-id>")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
const response = await fetch("https://api-<data-region>.central.sophos.com/xdr-query/v1/queries/runs/<runId>/results", {
method: "GET",
headers: {
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
},
});
const data = await response.json();
console.log(data);
Responses¶
200 — Query run results.¶
Response fields
itemsarray of objectOrdered list of JSON objects, one for each row in the results for the SQL query. A row JSON object has one field for each column in the SQL query. The value of the field is the value of the column.
metadataobjectMetadata for tabular data in
items.Show child attributesHide child attributes
columnsarray of objectList of columns.
Column metadata.
Show child attributesHide child attributes
namestringColumn name.
typestringColumn value type.
pagesobjectPage information.
Show child attributesHide child attributes
fromKeystring(Optional) The key of the first item in the returned page, returned only if the request was by key (the default if unspecified in the request).
nextKeystring(Optional) The key to use when fetching the next page.
sizeintegerrequiredThe size of the page being returned.
maxSizeintegerrequiredThe maximum page size that can be requested.
currentinteger(Optional) The 1-based page number being returned, returned only if the request was by offset.
totalinteger(Optional) The total number of pages that exist.
itemsinteger(Optional) The total number of items across all pages.
Errors¶
| Status | Meaning |
|---|---|
403 | Forbidden. |
404 | Can't find query run. |
500 | Unexpected error. |
All error responses share the same shape — see the error response object.
See the guide for a narrative walkthrough of this API.