We expose some parts of Approval Path functionality by API.

Authorization

You have to generate an API key in our app.

It is available in the Approval Path global view.

Click Apps in the top > Approval Path for Jira > API Keys > Create a new API Key

Setup your API key and copy or download it. The template has the following fields:

Change Performer Origin select offers three distinct options:

  1. User - to ensure smooth operations, it is essential to select a valid user as the new performer. This can be done by utilizing the option that allows the selection of a specific user.

  2. Issue field User - allows you to select an issue field of type User (or User array first element) to fetch the new performer. In cases where the selected issue field does not contain a valid user, you have the option to choose a default user. However, if no default user is selected and the issue field still does not contain a valid user, the API call will return an error.

  3. User from API call - API call body parameter allows for the passing of a user id. User ids can be limited to users from a designated group. In cases where the submitted user id is empty or does not contain a valid user, a default user can be selected. However, if the submitted user does not belong to the specified group, an error will be returned.

Using the Web API with API key

With key generated, you can now make a call to Web API. First of all, set Authorization and Content-Type headers in your REST client.

Authorization: Bearer mc96LyRi9nUQySSjKXEf8xfqUZzjS2CYhRK8bWSRRfQi
Content-Type: 'application/json'

Endpoints

Base path: https://app.approval-path.com/webapi

Definition

ref-id- In the case of Approval Path for Jira, this is project id or project key.

List of project definitions

GET /approval-definitions/{ref-id}

List of global definitions

GET /approval-definitions

{
  "result": [
    {
      "id": "53",
      "name": "users with create condition",
      "description": "",
      "collectionId": null,
      "steps": [
        {
          "type": "USER",
          "parallelGroupNumber": null,
          "userId": "557058:6e542a10-54a5-44e3-97b4-397df9caf04d",
          "action": "NOTIFICATION",
          "displayName": "Kamil Zarychta",
          "lastUpdated": null,
          "issueWatchersNotification": "ENABLED",
          "condition": {
            "id": 2
          }
        },
        {
          "type": "USER",
          "parallelGroupNumber": null,
          "userId": "557058:6e542a10-54a5-44e3-97b4-397df9caf04d",
          "action": "APPROVAL",
          "displayName": "Kamil Zarychta",
          "lastUpdated": null,
          "issueWatchersNotification": "ENABLED",
          "condition": {
            "id": 1
          }
        },
        {
          "type": "USER",
          "parallelGroupNumber": null,
          "userId": "557058:6e542a10-54a5-44e3-97b4-397df9caf04d",
          "action": "CONSENT",
          "displayName": "Kamil Zarychta",
          "lastUpdated": null,
          "issueWatchersNotification": "ENABLED",
          "condition": {
            "id": 2
          }
        }
      ],
      "rejectionSteps": [],
      "createApprovalCondition": {
        "id": 1
      },
      "availableForJSMCustomers": false
    },
    {
      "id": "95",
      "name": "parallel group with rejection steps",
      "description": "",
      "collectionId": null,
      "steps": [
        {
          "type": "USER",
          "parallelGroupNumber": null,
          "userId": "557058:6e542a10-54a5-44e3-97b4-397df9caf04d",
          "action": "APPROVAL",
          "displayName": "Kamil Zarychta",
          "lastUpdated": null,
          "issueWatchersNotification": "ENABLED"
        },
        {
          "type": "USER",
          "parallelGroupNumber": 1,
          "userId": "557058:6e542a10-54a5-44e3-97b4-397df9caf04d",
          "action": "APPROVAL",
          "displayName": "Kamil Zarychta",
          "lastUpdated": null,
          "issueWatchersNotification": "ENABLED",
          "condition": {
            "id": 3
          }
        },
        {
          "type": "EMAIL",
          "parallelGroupNumber": 1,
          "email": "kamilzarychta@gmail.com",
          "action": "APPROVAL",
          "issueWatchersNotification": "ENABLED"
        },
        {
          "type": "GROUP",
          "parallelGroupNumber": 1,
          "groupId": "83ebf594-d9e8-44c6-8ef6-db8a152d0009",
          "action": "APPROVAL",
          "requiredVotes": 1,
          "requiredRejectVotes": 3,
          "displayName": "administrators",
          "approvalCreatorExcluded": false,
          "skipFromApprovalWhenEmpty": false,
          "issueWatchersNotification": "ENABLED"
        }
      ],
      "rejectionSteps": [
        {
          "type": "HTTP",
          "parallelGroupNumber": null,
          "name": "webhook2",
          "httpMethod": "GET",
          "urlTemplate": "https://webhook.site/d42d1f3d-74a8-433e-b5a3-961d46505fe4?test=test",
          "headersTemplate": "",
          "bodyTemplate": "                ",
          "action": "NOTIFICATION",
          "issueWatchersNotification": "DISABLED"
        }
      ],
      "createApprovalCondition": null,
      "availableForJSMCustomers": false
    }
  ],
  "totalCount": 2
}

Approval

ref-id- In the case of Approval Path for Jira, this is issue id or issue key.

List approvals

GET /approvals/{ref-id}

Return example:

{
  "result": [
    {
      "id": "38",
      "definitionId": "35",
      "name": "Approval Name",
      "summary": "Ticket Summary",
      "collectionId": "10002",
      "refId": "10004",
      "steps": [
        {
          "type": "USER",
          "status": "SUCCESS",
          "userId": "557058:aea7ac02-75c1-4f47-9beb-dd89777d4949",
          "displayName": "Krzysztof Bogdan",
          "action": "STARTED",
          "decision": "ACCEPTED",
          "decisionDate": "2021-09-30T13:51:01.676+00:00"
        }
      ],
      "status": "IN_PROGRESS"
    }
  ],
  "totalCount": 1
}

When Change Performer Origin 'USER' is selected for API key approval create and reset requests can be extended to include the userId field.

Create approval

POST /approvals/{ref-id}

{
  "definitionId": "id",
  "summary": "Approval summary. Usually issue/page title",
  "userId": "Atlassian user id"
}

Reset approval

Allows user to reset ongoing or finalized approval path on an issue.

POST /approvals/{ref-id}/reset

Body parameters
createComment - Default false. If true, will generate a comment when approval path is reset via API. The creator of the API will be specified as the agent.

{
  "userId": "Atlassian user id"
}

This will reset the approval path - by default no comment will be generated.

{
  "createComment": true,
  "userId": "Atlassian user id"
}

This will reset the path and generate a comment.

{
    "result": [
        {
            "id": "469",
            "definitionId": "197",
            "name": "Bussines trip",
            "summary": "TRA-33 Trip to Vegas",
            "collectionId": "10000",
            "refId": "10068",
            "steps": [
                {
                    "type": "USER",
                    "type": "USER",
                    "status": "SUCCESS",
                    "userId": "6105b29ec51f3a0069c9ccda",
                    "displayName": "Parsa Shiva",
                    "parallelGroupNumber": null,
                    "action": "STARTED",
                    "decision": "ACCEPTED",
                    "decisionDate": "2022-09-26T15:32:42.340+00:00",
                    "lastUpdated": "2022-09-26T17:32:42+02:00"
                },
                {
                    "type": "USER",
                    "type": "USER",
                    "status": "SUCCESS",
                    "userId": "6105b29ec51f3a0069c9ccda",
                    "displayName": "Parsa Shiva",
                    "parallelGroupNumber": null,
                    "action": "APPROVAL",
                    "decision": "ACCEPTED",
                    "decisionDate": "2022-09-26T15:32:52.128+00:00",
                    "lastUpdated": null
                },
                {
                    "type": "USER",
                    "type": "USER",
                    "status": "SUCCESS",
                    "userId": "6299df401648f2006963deb8",
                    "displayName": "Jessica Smith",
                    "parallelGroupNumber": null,
                    "action": "APPROVAL",
                    "decision": "ACCEPTED",
                    "decisionDate": "2022-09-27T09:23:07.459+00:00",
                    "lastUpdated": null
                },
                {
                    "type": "USER",
                    "type": "USER",
                    "status": "SUCCESS",
                    "userId": "6299df401648f2006963deb8",
                    "displayName": "Jessica Smith",
                    "parallelGroupNumber": null,
                    "action": "APPROVAL",
                    "decision": "ACCEPTED",
                    "decisionDate": "2022-09-27T09:23:10.706+00:00",
                    "lastUpdated": null
                }
            ],
            "status": "SUCCESS",
            "activeSteps": [],
            "modificationDate": "2022-09-27T09:23:10.706+00:00"
        }
    ],
    "totalCount": 1
}