Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
stylenone

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

...

Go to the API Keys tab,

...

for Confluence > API Keys > Create a new API

...

Key

...

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

  • Key name - provide your name for the API key, up to 40 characters long.

  • Key value - non-modifable modifiable field, shows the value of the key.

  • Reveal - reveals the key. This is NOT one time operation - you can reveal the key at any time.

  • Download - downloads the key to the selected location.

  • Get page approval status - determines whether list approval for page Privileges (determines whether operation is allowed for the key.

  • List approval definitions - determines whether list approval definition operation is allowed for the key.

  • Create approval for page - determines whether create operation is allowed for the key.

  • Delete approval - determines whether delete operation is allowed for the key)

    • Definition

      • Create - create a new approval definition,

      • Read/Get - retrive an approval definition by ID or a list of definitions,

      • Update - update a definition by its ID,

      • Delete - delete a definition.

    • Approval

      • Create - create an approval path,

      • Read/Get - retrive an approval path by ID or a list of approval paths,

      • Delete - delete an approval.

  • Allow change performer origin - presents a valuable customization capability for users, empowering them to personalize change performer. Once checked, users are granted the flexibility to adjust performer origin according to their chosen parameters.

...

  • Not valid before - set the start date for key validity.

  • Not valid after - set the invalidation date for the key.

  • Allowed IPs - set IPs or IP range that can use the key.

  • Description - description of the key. Maximum 4000 characters.

  • Creation time - non-modifable modifiable field, the time when the key was created.

  • Last modified - non-modifable modifiable field, the time when the key was last modified.

  • Last usage - non-modifable modifiable field, the time when the key was last used.

  • Usage Count - non-modifable modifiable field, counter that shows how many times the key was used.

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.

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

Approval

ref-id- In the case of Approval Path for Confluence, this is page id.

List approvals

GET /approvals/{ref-id}

Return example:

Expand
titleExample response data
Code Block
languagejson
{
  "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",
          "avatarUrls": {
            "48x48": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:aea7ac02-75c1-4f47-9beb-dd89777d4949/f795c3d7-bee3-4444-9d39-0b18b81cb20b/48",
            "32x32": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:aea7ac02-75c1-4f47-9beb-dd89777d4949/f795c3d7-bee3-4444-9d39-0b18b81cb20b/32",
            "24x24": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:aea7ac02-75c1-4f47-9beb-dd89777d4949/f795c3d7-bee3-4444-9d39-0b18b81cb20b/24",
            "16x16": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:aea7ac02-75c1-4f47-9beb-dd89777d4949/f795c3d7-bee3-4444-9d39-0b18b81cb20b/16"
          },
          "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}

Expand
titleExample body
Code Block
{
  "definitionId": "id",
  "summary": "Approval summary. Usually issue/page title",
  "userId": "Atlassian user id"
}

Reset approval

Allows the 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 the approval path is reset via API. The creator of the API will be specified as the agent.

Expand
titleExample body
Code Block
{
  "userId": "Atlassian user id"
}

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

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

This will reset the path and generate a comment.

...

languagejson

...

Endpoints

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

Swc macro
urlhttps://app.approval-path.com/v3/api-docs/confluence