Automation Rules API

List automation rules

List all automation rules for an account:

GET /automation_rules

Response

Status: 200 OK
[
  {
    "id": 21,
    "disabled": false,
    "name": "Cancel task for new telephone",
    "trigger": "on status update",
    "position": 2,
    "created_at": "2020-02-15T05:08:46-06:00",
    "updated_at": "2020-02-15T05:08:46-06:00"
  },
  {
    "id": 20,
    "disabled": false,
    "name": "Add email address to AD task",
    "trigger": "on status update",
    "position": 1,
    "created_at": "2020-02-15T05:08:46-06:00",
    "updated_at": "2020-02-15T05:08:46-06:00"
  }
]

The response contains these fields by default. Filtering and pagination are available to reduce/limit the collection of automation rules.

Predefined Filters

The following predefined filters are available:

Collection Fields

By default the following fields will appear in collections of automation rules:

id disabled name trigger position created_at updated_at

In addition, one or two of the following fields appears, depending on the type of the automation rule:

generic request request_template task task_template workflow workflow_template project_task project_task_template project_template

Obtain a different set of fields using the ?fields=parameter.

Filtering

Filtering is available for the following fields:

id sourceID

The filter on sourceID is not case sensitive.

Sorting

By default a collection of automation rules is sorted descending by id.

The following fields are accepted by the ?sort=parameter:

id position

Get a single automation rule

GET /automation_rules/:id

Response

Status: 200 OK
{
  "actions": "a1: update badge_task add note 'This task was canceled because a security badge was not requested for the new employee.'\na2: update badge_task set status = canceled",
  "actions_html": "a1: update badge_task add note '<p>This task was canceled because a security badge was not requested for the new employee.</p>'\na2: update badge_task set status = canceled",
  "condition": "is_assigned and !badge",
  "created_at": "2020-02-15T05:08:46-06:00",
  "description": "This rule cancels the task for preparing a security badge for the new employee if this was not requested.",
  "description_html": "<p>This rule cancels the task for preparing a security badge for the new employee if this was not requested.</p>",
  "disabled": false,
  "expressions": "is_assigned: status = assigned\nrequest: workflow.requests[first]\nbadge: request.custom_fields.badge\nbadge_task: workflow.tasks['Prepare a security badge']",
  "generic": false,
  "id": 22,
  "name": "Cancel task for new badge",
  "position": 3,
  "source": null,
  "sourceID": null,
  "trigger": "on status update",
  "updated_at": "2020-02-15T05:08:46-06:00",
  "workflow_template": {
    "id": 22,
    "subject": "Prepare services for new employee"
  },
  "task_template": {
    "id": 69,
    "subject": "Cancel tasks that do not need to be completed"
  }
}

The response contains these fields.

Create a automation rule

POST /automation_rules

When creating a new automation rule these fields are available.

Response

Status: 201 Created
{
  "amount": "...",
  "...": "..."
}

The response contains all fields of the created automation rule and is similar to the response in Get a single automation rule.

Update a automation rule

PATCH /automation_rules/:id

When updating a automation rule these fields are available.

Response

Status: 200 OK
{
  "amount": "...",
  "...": "..."
}

The response contains all fields of the updated automation rule and is similar to the response in Get a single automation rule.

Fields

actions
Optional string (max 64KB) — The Actions field is used to define actions that should be executed when the condition of the automation rule is met. For example:
a1: update badge_task add note 'This task was canceled by automation.'
a2: update badge_task set status = canceled
actions_html
Readonly text (max 64KB) — Contents of the Actions field converted to HTML.
condition
Optional string (max 64KB) — The Condition field is used to define the condition that needs to be met in order for the update action(s) of the rule to be performed. For example: is_assigned and !badge.
created_at
Readonly datetime — The date and time at which the automation rule was created.
description
Optional text (max 64KB) — The Description field is used to enter a high-level description of the automation rule’s function. The available formatting options are described in the Text Formatting section.
description_html
Readonly text (max 64KB) — Contents of the Description field converted to HTML.
disabled
Optional boolean, default: false — The Disabled box is checked when the automation rule should not be triggered.
expressions
Optional string (max 64KB) — The Expressions field is used to define expressions that can subsequently be used to define the rule’s conditions and the update action(s) that the rule is to perform. For example:
is_assigned: status = assigned
request: workflow.requests[first]
badge: request.custom_fields.badge
badge_task: workflow.tasks['Prepare a security badge']
generic
Optional string (max 128) — When the automation rule is not linked to one specific record but to all records of a type, the Generic field contains the record type. Valid values are:
  • request
  • problem
  • workflow
  • task
  • risk
  • ci
  • scim_user
  • scim_group
id
Readonly integer — The unique ID of the automation rule.
name
Required string (max 128) — The Name field is used to enter the name of the automation rule.
position
Optional integer — The Position field dictates the order in which the automation rule is executed.
project_task
Optional reference to Project Task — The project task that the automation rule is linked to.
project_task_template
Optional reference to Project Task Template — The project task template that the automation rule is linked to.
project_template
Optional reference to Project Template — The project template that the automation rule is linked to.
request
Optional reference to Request — The request that the automation rule is linked to.
request_template
Optional reference to Request Template — The request template that the automation rule is linked to.
source
Optional string (max 30) — See source
sourceID
Optional string (max 128) — See source
task
Optional reference to Task — The Task that the automation rule is linked to.
task_template
Optional reference to Task Template — The Task Template that the automation rule is linked to.
trigger
Required string (max 128) — The Trigger field is used to specify when the automation rule is to be triggered, for example on status update or on note added.
updated_at
Readonly datetime — The date and time of the last update of the automation rule. If the automation rule has no updates it contains the created_at value.
workflow
Optional reference to Workflow — The workflow that the automation rule is linked to.
workflow_template
Optional reference to Workflow Template — The workflow template that the automation rule is linked to.