Job Router Administration Operations - Upsert Exception Policy

Creates or updates a exception policy.

PATCH {endpoint}/routing/exceptionPolicies/{exceptionPolicyId}?api-version=2023-11-01

URI Parameters

Name In Required Type Description
endpoint
path True

string

Uri of your Communication resource

exceptionPolicyId
path True

string

Id of an exception policy.

api-version
query True

string

The API version to use for this operation.

Request Header

Media Types: "application/merge-patch+json"

Name Required Type Description
If-Match

string

The request should only proceed if an entity matches this string.

If-Unmodified-Since

string

date-time-rfc7231

The request should only proceed if the entity was not modified after this time.

Request Body

Media Types: "application/merge-patch+json"

Name Type Description
exceptionRules

ExceptionRule[]

A collection of exception rules on the exception policy.

name

string

Friendly name of this policy.

Responses

Name Type Description
200 OK

ExceptionPolicy

The request has succeeded.

Headers

  • ETag: string
  • Last-Modified: string
201 Created

ExceptionPolicy

The request has succeeded and a new resource has been created as a result.

Headers

  • ETag: string
  • Last-Modified: string
Other Status Codes

Azure.Core.Foundations.ErrorResponse

An unexpected error response.

Headers

x-ms-error-code: string

Examples

Creates an exception policy
Updates an exception policy

Creates an exception policy

Sample request

PATCH https://contoso.westus.communications.azure.com/routing/exceptionPolicies/cf1cda69-6f41-45ac-b252-213293f1b1cb?api-version=2023-11-01

{
  "name": "Main",
  "exceptionRules": [
    {
      "id": "MaxWaitTimeExceeded",
      "actions": [
        {
          "kind": "reclassify",
          "classificationPolicyId": "Main",
          "labelsToUpsert": {
            "escalated": true
          }
        }
      ],
      "trigger": {
        "kind": "waitTime",
        "thresholdSeconds": 20
      }
    }
  ]
}

Sample response

{
  "id": "cf1cda69-6f41-45ac-b252-213293f1b1cb",
  "name": "Main",
  "exceptionRules": [
    {
      "id": "MaxWaitTimeExceeded",
      "trigger": {
        "kind": "waitTime",
        "thresholdSeconds": 20
      },
      "actions": [
        {
          "id": "babd4f6f-916e-4e91-9c89-e0bb05a2c425",
          "kind": "reclassify",
          "classificationPolicyId": "Main",
          "labelsToUpsert": {
            "escalated": true
          }
        }
      ]
    }
  ],
  "etag": "etag"
}
{
  "id": "cf1cda69-6f41-45ac-b252-213293f1b1cb",
  "name": "Main",
  "exceptionRules": [
    {
      "id": "MaxWaitTimeExceeded",
      "trigger": {
        "kind": "waitTime",
        "thresholdSeconds": 20
      },
      "actions": [
        {
          "id": "babd4f6f-916e-4e91-9c89-e0bb05a2c425",
          "kind": "reclassify",
          "classificationPolicyId": "Main",
          "labelsToUpsert": {
            "escalated": true
          }
        }
      ]
    }
  ],
  "etag": "etag"
}

Updates an exception policy

Sample request

PATCH https://contoso.westus.communications.azure.com/routing/exceptionPolicies/cf1cda69-6f41-45ac-b252-213293f1b1cb?api-version=2023-11-01

{
  "name": "Main test",
  "exceptionRules": [
    {
      "id": "MaxWaitTimeExceeded",
      "actions": [
        {
          "kind": "reclassify",
          "classificationPolicyId": "Main",
          "labelsToUpsert": {
            "escalated": true
          }
        }
      ],
      "trigger": {
        "kind": "waitTime",
        "thresholdSeconds": 20
      }
    }
  ]
}

Sample response

{
  "id": "cf1cda69-6f41-45ac-b252-213293f1b1cb",
  "name": "Main test",
  "exceptionRules": [
    {
      "id": "MaxWaitTimeExceeded",
      "trigger": {
        "kind": "waitTime",
        "thresholdSeconds": 20
      },
      "actions": [
        {
          "id": "babd4f6f-916e-4e91-9c89-e0bb05a2c425",
          "kind": "reclassify",
          "classificationPolicyId": "Main",
          "labelsToUpsert": {
            "escalated": true
          }
        }
      ]
    }
  ],
  "etag": "etag"
}
{
  "id": "cf1cda69-6f41-45ac-b252-213293f1b1cb",
  "name": "Main test",
  "exceptionRules": [
    {
      "id": "MaxWaitTimeExceeded",
      "trigger": {
        "kind": "waitTime",
        "thresholdSeconds": 20
      },
      "actions": [
        {
          "id": "babd4f6f-916e-4e91-9c89-e0bb05a2c425",
          "kind": "reclassify",
          "classificationPolicyId": "Main",
          "labelsToUpsert": {
            "escalated": true
          }
        }
      ]
    }
  ],
  "etag": "etag"
}

Definitions

Name Description
Azure.Core.Foundations.Error

The error object.

Azure.Core.Foundations.ErrorResponse

A response containing error details.

Azure.Core.Foundations.InnerError

An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.

CancelExceptionAction

An action that marks a job as cancelled.

ExceptionActionKind

Discriminators for supported exception action types.

ExceptionPolicy

A policy that defines actions to execute when exception are triggered.

ExceptionPolicyCreateOrUpdate

A policy that defines actions to execute when exception are triggered.

ExceptionRule

A rule that defines actions to execute upon a specific trigger.

ExceptionTriggerKind

Discriminators for supported exception trigger types.

LabelOperator

Describes supported operations on label values.

ManualReclassifyExceptionAction

An action that manually reclassifies a job by providing the queue, priority and worker selectors.

QueueLengthExceptionTrigger

Trigger for an exception action on exceeding queue length.

ReclassifyExceptionAction

An action that modifies labels on a job and then reclassifies it.

RouterWorkerSelector

Describes a condition that must be met against a set of labels for worker selection.

RouterWorkerSelectorStatus

Describes the status of a worker selector.

WaitTimeExceptionTrigger

Trigger for an exception action on exceeding wait time.

Azure.Core.Foundations.Error

The error object.

Name Type Description
code

string

One of a server-defined set of error codes.

details

Azure.Core.Foundations.Error[]

An array of details about specific errors that led to this reported error.

innererror

Azure.Core.Foundations.InnerError

An object containing more specific information than the current object about the error.

message

string

A human-readable representation of the error.

target

string

The target of the error.

Azure.Core.Foundations.ErrorResponse

A response containing error details.

Name Type Description
error

Azure.Core.Foundations.Error

The error object.

Azure.Core.Foundations.InnerError

An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.

Name Type Description
code

string

One of a server-defined set of error codes.

innererror

Azure.Core.Foundations.InnerError

Inner error.

CancelExceptionAction

An action that marks a job as cancelled.

Name Type Description
dispositionCode

string

Indicates the outcome of a job, populate this field with your own custom values.

id

string

Unique Id of the exception action.

kind string:

cancel

The type discriminator describing a sub-type of ExceptionAction.

note

string

A note that will be appended to a job's notes collection with the current timestamp.

ExceptionActionKind

Discriminators for supported exception action types.

Name Type Description
cancel

string

Discriminator value for CancelExceptionAction.

manualReclassify

string

Discriminator value for ManualReclassifyExceptionAction.

reclassify

string

Discriminator value for ReclassifyExceptionAction.

ExceptionPolicy

A policy that defines actions to execute when exception are triggered.

Name Type Description
etag

string

The entity tag for this resource.

exceptionRules

ExceptionRule[]

A collection of exception rules on the exception policy.

id

string

Id of an exception policy.

name

string

Friendly name of this policy.

ExceptionPolicyCreateOrUpdate

A policy that defines actions to execute when exception are triggered.

Name Type Description
exceptionRules

ExceptionRule[]

A collection of exception rules on the exception policy.

name

string

Friendly name of this policy.

ExceptionRule

A rule that defines actions to execute upon a specific trigger.

Name Type Description
actions ExceptionAction[]:

A collection of actions to perform once the exception is triggered.

id

string

Id of an exception rule.

trigger ExceptionTrigger:

The trigger for this exception rule.

ExceptionTriggerKind

Discriminators for supported exception trigger types.

Name Type Description
queueLength

string

Discriminator value for QueueLengthExceptionTrigger.

waitTime

string

Discriminator value for WaitTimeExceptionTrigger.

LabelOperator

Describes supported operations on label values.

Name Type Description
equal

string

Equal.

greaterThan

string

Greater than.

greaterThanOrEqual

string

Greater than or equal.

lessThan

string

Less than.

lessThanOrEqual

string

Less than or equal.

notEqual

string

Not Equal.

ManualReclassifyExceptionAction

An action that manually reclassifies a job by providing the queue, priority and worker selectors.

Name Type Description
id

string

Unique Id of the exception action.

kind string:

manualReclassify

The type discriminator describing a sub-type of ExceptionAction.

priority

integer

Updated Priority.

queueId

string

Updated QueueId.

workerSelectors

RouterWorkerSelector[]

Updated WorkerSelectors.

QueueLengthExceptionTrigger

Trigger for an exception action on exceeding queue length.

Name Type Description
kind string:

queueLength

The type discriminator describing a sub-type of ExceptionTrigger.

threshold

integer

Threshold of number of jobs ahead in the queue to for this trigger to fire.

ReclassifyExceptionAction

An action that modifies labels on a job and then reclassifies it.

Name Type Description
classificationPolicyId

string

The new classification policy that will determine queue, priority and worker selectors.

id

string

Unique Id of the exception action.

kind string:

reclassify

The type discriminator describing a sub-type of ExceptionAction.

labelsToUpsert

Dictionary containing the labels to update (or add if not existing) in key-value pairs. Values must be primitive values - number, string, boolean.

RouterWorkerSelector

Describes a condition that must be met against a set of labels for worker selection.

Name Type Description
expedite

boolean

Pushes a job to the front of the queue as long as this selector is active.

expiresAfterSeconds

number

Describes how long this label selector is valid in seconds.

expiresAt

string

The time at which this worker selector expires in UTC.

key

string

The label key to query against.

labelOperator

LabelOperator

Describes how the value of the label is compared to the value defined on the worker selector.

status

RouterWorkerSelectorStatus

Status of the worker selector.

value

The value to compare against the actual label value with the given operator. Values must be primitive values - number, string, boolean.

RouterWorkerSelectorStatus

Describes the status of a worker selector.

Name Type Description
active

string

Worker selector is valid.

expired

string

Worker selector is not valid.

WaitTimeExceptionTrigger

Trigger for an exception action on exceeding wait time.

Name Type Description
kind string:

waitTime

The type discriminator describing a sub-type of ExceptionTrigger.

thresholdSeconds

number

Threshold for wait time for this trigger.