Suppress Rules and Custom Processes

There are some custom HTTP headers that can be used with POST, PATCH, and DELETE requests to suppress rules, custom processes, or both. They are:

  • OSvC-CREST-Suppress-Rule: Suppresses rules when specified as 'true' or 'yes'. This header can't be used with DELETE.

  • OSvC-CREST-Suppress-ExternalEvents: Suppresses custom processes when specified as 'true' or 'yes'.

  • OSvC-CREST-Suppress-All: Suppresses both rules and custom processes when specified as 'true' or 'yes'.

Let's look at an example to understand how these REST headers work.

John Smith is a site developer responsible for implementing a custom site for managing incidents. Incidents are typically questions or requests for help submitted by customers or agents who interact with the customers. John uses the REST APIs to synchronize the site data from an external system but he doesn't want any rules to be executed when incidents are created through REST APIs. To suppress the rules, John can use the 'OSvC-CREST-Suppress-Rules' header with the value 'true' in his REST API call.

You can use the following steps to go about this task:

  1. View the rules related to Incident object in the Rules editor

  2. Decide whether you want to suppress the rules when an incident is created using REST APIs

  3. Create an Incident

Create an Incident

Suppose you want to create an incident using REST APIs and suppress the rules, you can create the incident as follows:

  1. Construct the request URL for the Create an incident operation

  2. Construct the request body for this operation

  3. Specify the header parameter. In this scenario you use the 'OSvC-CREST-Suppress-Rules' parameter to suppress rules

  4. Run the request using the POST HTTP method to create the incident

Example URL

Here's the complete URL with the POST HTTP method. The value of the 'OSvC-CREST-Suppress-Rules' header is set to 'true'.

POST
https://mysite.example.com/services/rest/connect/v1.4/incidents

Example Request Body

{
"primaryContact":
    {
    "id": 2
    },
"subject": "GPhone not working"
}

cURL Command

curl -X POST https://mysite.example.com/services/rest/connect/v1.4/incidents -H 'Authorization: Basic YWRtaW46' -H 'Content-Type: application/json' -H 'OSvC-CREST-Application-Context: Create an incident' -H 'OSvC-CREST-Suppress-Rules: true' -d '{ "primaryContact": { "id": 2 }, "subject": "GPhone not working" }'

Example Response

Here's an example of the response body in JSON format.

{
  "id": 67,
  "lookupName": "160128-000000",
  "createdTime": "2016-01-28T21:06:35.000Z",
  "updatedTime": "2016-01-28T21:06:35.000Z",
    "asset": null,
    "assignedTo": {
        "account": null,
        "staffGroup": null
        },
    ...
    "primaryContact": {
        "links": [
        {
            "rel": "self",
            "href": "https://mysite.example.com/services/rest/connect/v1.4/contacts/2"
            },
        {
            "rel": "canonical",
            "href": "https://mysite.example.com/services/rest/connect/v1.4/contacts/2"
            },
        {
            "rel": "describedby",
            "href": "https://mysite.example.com/services/rest/connect/v1.4/metadata-catalog/contacts"
            }
        ]
    },
    ...
    "subject": "GPhone not working",
    "threads": {
        "links": [
        {
            "rel": "self",
            "href": "https://mysite.example.com/services/rest/connect/v1.4/incidents/32/threads"
            }
        ]
    },
    "links": [
    {
        "rel": "self",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/incidents/32"
        },
    {
        "rel": "canonical",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/incidents/32"
        },
    {
        "rel": "describedby",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/metadata-catalog/incidents"
        },
    {
        "rel": "alternate",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/incidents/32",
        "mediaType": "application/schema+json"
        }
    ]
}

Note:

In this example, you created an incident with the subject "GPhone not working" using the REST API. Suppose, you have a rule named "Route GPhone incidents" which checks for the following condition:
IF { Incident.Subject contains "GPhone" }
THEN { Assign Queue - Tier1 }

Although the rule condition matches, this rule or any incident rule will not be triggered because the 'OSvC-CREST-Suppress-Rules' header is set to 'true'.