Update an SLA policy (needs the current version), or check its impact first with dryRun (desk:admin)
PUT /api/desk/v1/sla/policies/{id}
Module: Desk · operationId: updateSlaPolicy · Tag: SLA · Auth: access token (Authorization: Bearer <accessToken>)
With dryRun=true nothing is saved: the policy is validated as for saving and the answer is its impact on the
open tickets the admin sees (at most 500, truncated when there are more) – how many it matches now and would
match after the change, and up to ten ticket numbers it gains and loses. Running clocks keep their policy until
POST /sla/recalculate; new clocks follow the change.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string (uuid) | yes | |
dryRun |
query | boolean | Answer the impact, save nothing |
Request body
application/json (required)
key(string, required): Key of the policy, unique in the tenantname(string, required): Name of the policytargets(array of object, required): Targets of the policyminutes(integer, required): Target in minutestarget(string, required): What is measured (one offirst_response,resolution,next_response)byPriority(object): Minutes per priority keyescalations(array of object): Levels of the target: when a clock reachespercentof it, desk writes the eventdesk.sla.escalatedwith the level – what happens then is an automation's or a flow's (a level has no actions of its own).id(string, required): Key-like idpercent(integer, required): Share of the target at which the level is reached (max 1000)name(string): Name of the level (at most 120 characters), in the event asescalation.name
mode(string): business: service hours of the calendar; wall: wall-clock time (one ofbusiness,wall)warnPercent(integer): Share of the target at which the clock warns (default80)
archived(boolean): Archived: the policy is kept for existing data but no longer offered in pickerscalendar(string): Calendar key; empty = the default calendardescription(string): Description of the policyenabled(boolean): Disabled policies never matchid(string, read-only): Id of the policymatch(string): The tickets the policy applies to: a bool expression in the flow language overtrigger.data, the ticket's event payload (GET /conditions/catalog,item) – the first enabled policy whose match holds applies. Empty: every ticket. One that cannot be evaluated for a ticket does not hold (logged). (max length 4000)position(integer, read-only): Matching order (the first enabled policy that matches applies)reevaluateOn(array of string): Item fields whose change re-matches the policy and recalculates running clocks (e.g. priority)version(integer): Version of the policy; send it back on change (409 version_conflict when it is outdated)note(string): Why the configuration changes (trimmed, at most 500 characters, line breaks allowed; empty = no note) (max length 500)
Example:
{
"enabled": true,
"id": "9d6e7f8a-0b1c-4d2e-9f4a-6b7c8d9e0f01",
"key": "standard",
"match": "trigger.data.spaceKey == \"SUP\"",
"name": "Standard",
"note": "Erste Reaktion auf drei Stunden verkürzt",
"targets": [
{
"minutes": 180,
"mode": "business",
"target": "first_response",
"warnPercent": 80
},
{
"byPriority": {
"hoch": 480,
"kritisch": 240,
"niedrig": 2880,
"normal": 1440
},
"minutes": 1440,
"mode": "business",
"target": "resolution",
"warnPercent": 80
}
],
"version": 2
}
Responses
- 200 Saved (the policy), or with dryRun the impact (
application/json) - 409 Version conflict
Fields of the 200 answer:
key(string, required): Key of the policy, unique in the tenantname(string, required): Name of the policytargets(array of object, required): Targets of the policyminutes(integer, required): Target in minutestarget(string, required): What is measured (one offirst_response,resolution,next_response)byPriority(object): Minutes per priority keyescalations(array of object): Levels of the target: when a clock reachespercentof it, desk writes the eventdesk.sla.escalatedwith the level – what happens then is an automation's or a flow's (a level has no actions of its own).id(string, required): Key-like idpercent(integer, required): Share of the target at which the level is reached (max 1000)name(string): Name of the level (at most 120 characters), in the event asescalation.name
mode(string): business: service hours of the calendar; wall: wall-clock time (one ofbusiness,wall)warnPercent(integer): Share of the target at which the clock warns (default80)
archived(boolean): Archived: the policy is kept for existing data but no longer offered in pickerscalendar(string): Calendar key; empty = the default calendardescription(string): Description of the policyenabled(boolean): Disabled policies never matchid(string, read-only): Id of the policymatch(string): The tickets the policy applies to: a bool expression in the flow language overtrigger.data, the ticket's event payload (GET /conditions/catalog,item) – the first enabled policy whose match holds applies. Empty: every ticket. One that cannot be evaluated for a ticket does not hold (logged). (max length 4000)position(integer, read-only): Matching order (the first enabled policy that matches applies)reevaluateOn(array of string): Item fields whose change re-matches the policy and recalculates running clocks (e.g. priority)version(integer): Version of the policy; send it back on change (409 version_conflict when it is outdated)checked(integer, required): Open tickets evaluateddryRun(boolean, required): Always true – tells the impact from a saved policygained(array of string, required): Up to ten ticket numbers (#123) the policy would newly matchlost(array of string, required): Up to ten ticket numbers it would no longer matchmatchAfter(integer, required)matchedNow(integer, required)truncated(boolean, required): There were more open tickets than evaluated
Example 200 answer:
{
"checked": 42,
"dryRun": true,
"gained": [
"#37",
"#41"
],
"lost": [],
"matchAfter": 33,
"matchedNow": 31,
"truncated": false
}
Example request
curl -X PUT 'https://api.mbcom.cloud/api/desk/v1/sla/policies/3f2b8c1e-7d4a-4e9b-9c2a-5b1d6e8f0a12' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
--data '{"enabled":true,"id":"9d6e7f8a-0b1c-4d2e-9f4a-6b7c8d9e0f01","key":"standard","match":"trigger.data.spaceKey == \"SUP\"","name":"Standard","note":"Erste Reaktion auf drei Stunden verkürzt","targets":[{"minutes":180,"mode":"business","target":"first_response","warnPercent":80},{"byPriority":{"hoch":480,"kritisch":240,"niedrig":2880,"normal":1440},"minutes":1440,"mode":"business","target":"resolution","warnPercent":80}],"version":2}'