Update the compliance ticket settings and exceptions
Change whether compliance issues open tickets on their own and the defaults of those tickets (ticket: autoCreateTickets, assignee, priority, subscribers) and the exceptions (exceptions: leave unassigned or in-stock devices out, grace period). Only the fields sent change; the others keep their value. subscribers replaces the whole list, and null clears the assignee or the priority. A person is a Primo employee (type EMPLOYEE, from getEmployees) or an admin with no employee record (type EXTERNAL_ADMIN, the userId from getAdmins); anyone else is refused with 400. New defaults apply to tickets opened afterwards, never to open ones. Changing exceptions or autoCreateTickets recomputes every device, so issues and their tickets appear or close within minutes. Auto-remediation is switched with publishComplianceRemediationPolicy / unpublishComplianceRemediationPolicy, and which statuses raise an issue with updateComplianceAlertRule. getComplianceSettings reads the current values the change replaces. Demo companies are not allowed to change these settings (403).
curl --request PATCH \
--url https://api.getprimo.com/compliance/settings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ticket": {
"autoCreateTickets": true,
"assignee": {
"type": "EMPLOYEE",
"employeeId": "<string>"
},
"subscribers": [
{
"type": "EMPLOYEE",
"employeeId": "<string>"
}
]
},
"exceptions": {
"excludeUnassignedDevices": true,
"excludeDevicesInStock": true,
"gracePeriodDays": 15
}
}
'import requests
url = "https://api.getprimo.com/compliance/settings"
payload = {
"ticket": {
"autoCreateTickets": True,
"assignee": {
"type": "EMPLOYEE",
"employeeId": "<string>"
},
"subscribers": [
{
"type": "EMPLOYEE",
"employeeId": "<string>"
}
]
},
"exceptions": {
"excludeUnassignedDevices": True,
"excludeDevicesInStock": True,
"gracePeriodDays": 15
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ticket: {
autoCreateTickets: true,
assignee: {type: 'EMPLOYEE', employeeId: '<string>'},
subscribers: [{type: 'EMPLOYEE', employeeId: '<string>'}]
},
exceptions: {
excludeUnassignedDevices: true,
excludeDevicesInStock: true,
gracePeriodDays: 15
}
})
};
fetch('https://api.getprimo.com/compliance/settings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getprimo.com/compliance/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'ticket' => [
'autoCreateTickets' => true,
'assignee' => [
'type' => 'EMPLOYEE',
'employeeId' => '<string>'
],
'subscribers' => [
[
'type' => 'EMPLOYEE',
'employeeId' => '<string>'
]
]
],
'exceptions' => [
'excludeUnassignedDevices' => true,
'excludeDevicesInStock' => true,
'gracePeriodDays' => 15
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getprimo.com/compliance/settings"
payload := strings.NewReader("{\n \"ticket\": {\n \"autoCreateTickets\": true,\n \"assignee\": {\n \"type\": \"EMPLOYEE\",\n \"employeeId\": \"<string>\"\n },\n \"subscribers\": [\n {\n \"type\": \"EMPLOYEE\",\n \"employeeId\": \"<string>\"\n }\n ]\n },\n \"exceptions\": {\n \"excludeUnassignedDevices\": true,\n \"excludeDevicesInStock\": true,\n \"gracePeriodDays\": 15\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.getprimo.com/compliance/settings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ticket\": {\n \"autoCreateTickets\": true,\n \"assignee\": {\n \"type\": \"EMPLOYEE\",\n \"employeeId\": \"<string>\"\n },\n \"subscribers\": [\n {\n \"type\": \"EMPLOYEE\",\n \"employeeId\": \"<string>\"\n }\n ]\n },\n \"exceptions\": {\n \"excludeUnassignedDevices\": true,\n \"excludeDevicesInStock\": true,\n \"gracePeriodDays\": 15\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getprimo.com/compliance/settings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ticket\": {\n \"autoCreateTickets\": true,\n \"assignee\": {\n \"type\": \"EMPLOYEE\",\n \"employeeId\": \"<string>\"\n },\n \"subscribers\": [\n {\n \"type\": \"EMPLOYEE\",\n \"employeeId\": \"<string>\"\n }\n ]\n },\n \"exceptions\": {\n \"excludeUnassignedDevices\": true,\n \"excludeDevicesInStock\": true,\n \"gracePeriodDays\": 15\n }\n}"
response = http.request(request)
puts response.read_body{
"ticket": {
"autoCreateTickets": true,
"assignee": {
"type": "EMPLOYEE",
"employeeId": "<string>"
},
"priority": "LOW",
"subscribers": [
{
"type": "EMPLOYEE",
"employeeId": "<string>"
}
]
},
"exceptions": {
"excludeUnassignedDevices": true,
"excludeDevicesInStock": true,
"gracePeriodDays": 15
}
}Authorizations
Body
curl --request PATCH \
--url https://api.getprimo.com/compliance/settings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ticket": {
"autoCreateTickets": true,
"assignee": {
"type": "EMPLOYEE",
"employeeId": "<string>"
},
"subscribers": [
{
"type": "EMPLOYEE",
"employeeId": "<string>"
}
]
},
"exceptions": {
"excludeUnassignedDevices": true,
"excludeDevicesInStock": true,
"gracePeriodDays": 15
}
}
'import requests
url = "https://api.getprimo.com/compliance/settings"
payload = {
"ticket": {
"autoCreateTickets": True,
"assignee": {
"type": "EMPLOYEE",
"employeeId": "<string>"
},
"subscribers": [
{
"type": "EMPLOYEE",
"employeeId": "<string>"
}
]
},
"exceptions": {
"excludeUnassignedDevices": True,
"excludeDevicesInStock": True,
"gracePeriodDays": 15
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ticket: {
autoCreateTickets: true,
assignee: {type: 'EMPLOYEE', employeeId: '<string>'},
subscribers: [{type: 'EMPLOYEE', employeeId: '<string>'}]
},
exceptions: {
excludeUnassignedDevices: true,
excludeDevicesInStock: true,
gracePeriodDays: 15
}
})
};
fetch('https://api.getprimo.com/compliance/settings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getprimo.com/compliance/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'ticket' => [
'autoCreateTickets' => true,
'assignee' => [
'type' => 'EMPLOYEE',
'employeeId' => '<string>'
],
'subscribers' => [
[
'type' => 'EMPLOYEE',
'employeeId' => '<string>'
]
]
],
'exceptions' => [
'excludeUnassignedDevices' => true,
'excludeDevicesInStock' => true,
'gracePeriodDays' => 15
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getprimo.com/compliance/settings"
payload := strings.NewReader("{\n \"ticket\": {\n \"autoCreateTickets\": true,\n \"assignee\": {\n \"type\": \"EMPLOYEE\",\n \"employeeId\": \"<string>\"\n },\n \"subscribers\": [\n {\n \"type\": \"EMPLOYEE\",\n \"employeeId\": \"<string>\"\n }\n ]\n },\n \"exceptions\": {\n \"excludeUnassignedDevices\": true,\n \"excludeDevicesInStock\": true,\n \"gracePeriodDays\": 15\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.getprimo.com/compliance/settings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ticket\": {\n \"autoCreateTickets\": true,\n \"assignee\": {\n \"type\": \"EMPLOYEE\",\n \"employeeId\": \"<string>\"\n },\n \"subscribers\": [\n {\n \"type\": \"EMPLOYEE\",\n \"employeeId\": \"<string>\"\n }\n ]\n },\n \"exceptions\": {\n \"excludeUnassignedDevices\": true,\n \"excludeDevicesInStock\": true,\n \"gracePeriodDays\": 15\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getprimo.com/compliance/settings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ticket\": {\n \"autoCreateTickets\": true,\n \"assignee\": {\n \"type\": \"EMPLOYEE\",\n \"employeeId\": \"<string>\"\n },\n \"subscribers\": [\n {\n \"type\": \"EMPLOYEE\",\n \"employeeId\": \"<string>\"\n }\n ]\n },\n \"exceptions\": {\n \"excludeUnassignedDevices\": true,\n \"excludeDevicesInStock\": true,\n \"gracePeriodDays\": 15\n }\n}"
response = http.request(request)
puts response.read_body{
"ticket": {
"autoCreateTickets": true,
"assignee": {
"type": "EMPLOYEE",
"employeeId": "<string>"
},
"priority": "LOW",
"subscribers": [
{
"type": "EMPLOYEE",
"employeeId": "<string>"
}
]
},
"exceptions": {
"excludeUnassignedDevices": true,
"excludeDevicesInStock": true,
"gracePeriodDays": 15
}
}