List violations¶
GET/
Mobile API · Devices
Get list of compliance violations.
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string (uuid) | Yes | Unique object identifier. |
X-Tenant-ID | header | string (uuid) | Yes | Tenant ID. |
fields | query | array of string | No | The fields to return in a partial response. |
view | query | string | No | Type of view to be returned in response. Must be one of: basic, summary, full. |
sort | query | array of string | No | Defines how to sort the data. Each item must match the pattern (^[^:]+$)|(^[^:]+:(asc|desc)$). |
page | query | integer | No | The page number to fetch, starting with 1. |
pageSize | query | integer | No | The size of the page requested. |
pageTotal | query | boolean | No | Whether the number of pages should be calculated and returned in the response. |
violationSeverity | query | array of string (enum) | No | Filter objects by compliance violation severity. Each item must be one of: low, medium, high. |
Request samples¶
curl -X GET "https://api-<data-region>.central.sophos.com/mobile/v1/devices/<id>/compliance-violations" -H "Authorization: Bearer <access-token>" -H "X-Tenant-ID: <tenant-id>"
import requests
response = requests.get(
"https://api-<data-region>.central.sophos.com/mobile/v1/devices/<id>/compliance-violations",
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/mobile/v1/devices/<id>/compliance-violations" -Headers $headers
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://api-<data-region>.central.sophos.com/mobile/v1/devices/<id>/compliance-violations", 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/mobile/v1/devices/<id>/compliance-violations", {
method: "GET",
headers: {
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
},
});
const data = await response.json();
console.log(data);
Responses¶
200 — List of compliance violations.¶
Response fields
itemsarray of objectrequiredList of compliance violations.
Information about a violation of a specific compliance rule.
Show child attributesHide child attributes
descriptionstringInformation about the compliance violation.
detectedAtstring (date-time)Timestamp of the violation detection.
typestringThe violation type.
severitystring (enum)The highest severity of a compliance violation.
Must be one of:
Must be one of:
low, medium, high.pagesobjectrequiredShow child attributesHide child attributes
currentintegerrequiredThe 1-based page number being returned.
sizeintegerrequiredThe size of the page being returned.
totalinteger(Optional) The total number of pages that exist, if pageTotal=true in the request.
itemsinteger(Optional) The total number of items across all pages.
maxSizeintegerrequiredThe maximum page size that can be requested.
Errors¶
| Status | Meaning |
|---|---|
400 | Invalid request. |
401 | Unauthorized. |
403 | Forbidden. |
404 | Unknown device ID. |
429 | Too many requests. See Retry-After header. |
500 | Internal server error. |
All error responses share the same shape — see the error response object.
See the guide for a narrative walkthrough of this API.