We have a new documentation site. Please go here to see the latest.

API

 

Introduction

You can use the Jira REST API to interact with the Checklist. This page documents the REST resources available to use, including example requests and responses. Use this API to build script interactions with your checklist, or develop any other type of integration.

  • This guide applies to Jira REST API version 2 calls only. While the latest Jira REST API version is 3, it does not currently work with Checklists. 

  • This guide applies to Jira Company-managed (Classic) projects only. Team-managed (Next-Gen) projects do not support global custom fields, which are required for checklist REST API access.

  • Note that you can access checklist data from local (not Global) checklists stored in custom fields even if the Checklist app has been uninstalled. 

  • The endpoints described here access local checklists only. You can use entity properties to access the overall state of checklists on the issue, with global checklists included.

Requirements


Authentication

Following guide is based on basic-authentication which means that all calls will impersonate the user. The user must have view issue and edit issue permissions. A valid API Token for the user’s Atlassian account is also required.

 

In the examples below, you will need to replace the following items:

Item

Replace with

Example

Item

Replace with

Example

email@example.com 

The email address provided in your Atlassian ID account

stevan@herocoders.com

<api_token>

A valid API token for your Atlassian ID

J3D4smrVz29cxzsd

https://your-domain.atlassian.net

The URL of your Jira Cloud instance

https://herocoders.atlassian.net

{issueIdOrKey}

The relevant issue key

DEMO-1

"customfield_XXXXX" where XXXXX is the custom field ID number

The ID of the Checklist Text custom field in your instance. Follow these instructions for getting the custom field ID.

"customfield_10034"

 


Get, Update or Remove Checklist

You will need to replace the custom field ID with the ID of the Checklist Text field in your instance.

Get a Checklist

GET /rest/api/2/issue/{issueIdOrKey} (reference)

Returns the details of an issue, including the checklist in text format.

cURL example:
curl --request GET \ --url 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}' \ --user 'email@example.com:<api_token>' \ --header 'Accept: application/json'
Example response (application/json):
{ "expand": "", "id": "10002", "self": "https://your-domain.atlassian.net/rest/api/2/issue/10002", "key": "DEMO-1", "fields": { (...) // omitted for brevity "customfield_XXXXX": "--- Tested on\n* Chrome\n* Safari\n* Firefox\n* Edge\n* [x] IE11", } (...) // omitted for brevity }

Create or Update a Checklist

PUT /rest/api/2/issue/{issueIdOrKey} (reference)

Updates the issue by adding or updating a formatted checklist.

The Checklist Text custom field must be present on the Edit issue screen. Follow instructions here for adding a field to a screen.

 

cURL example:
curl --request PUT \ --url 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}' \ --user 'email@example.com:<api_token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "fields": { "customfield_XXXXX": "--- Tested on\n* [x] Chrome\n* Safari\n* Firefox\n* Edge\n* [x] IE11\n--- Mobile\n* Android\n* iPhone" } }'
Response errors:

Remove a Checklist

Deletes a checklist by passing a null or empty value for to the Checklist Text custom field.

cURL example:

Read, Modify & Update Checklists

You may want to retrieve a checklist from a Jira issue, modify the checklist’s items (for example, mark them as complete), and pass the updated checklist back to Jira issue. The steps are:

  1. Retrieve a representation of the issue via GET /rest/api/2/issue/{issueIdOrKey}

  2. Using Checklist Text field id, extract and parse checklist value: representation → fields → customfield_XXXXX (parse items by new line characters)

  3. Modify the parsed checklist as needed. For example, to check an item as complete, put an "x" in the square brackets (so that "* [] summary" becomes "* [x] summary"). 

  4. Upload the modified value back to the issue via PUT /rest/api/2/issue/{issueIdOrKey}

Add a Checklist to the Issue (cURL)

  1. Open terminal.

  2. Save the content of the snippet below to a local file, e.g. example.json:

    Text

    Replace customfield_12345 string with the ID of Checklist Text custom field in your Jira instance. See instructions here for finding custom field ID.

  3. Type following command in the terminal.

    Replace jack@herocoders.com with the email address provided in your Atlassian ID account. 
    Replace api_token with a valid token generated in your Atlassian ID account (see instructions for generating tokens).
    Replace jiraUrl with URL of your Jira instance.
    Replace DEMO-1 with the appropriate issue key. 

  4. Go to Jira issue page to confirm that:

    1. Checklist has been updated and contains a single checked item "example item".

    2. The Checklist Text field has been updated with the checklist provided in example.json file. This will be visible if the Checklist Text field is on the View Issue Screen:




      You can also see that the other checklist custom fields (Checklist Progress and Checklist Completed) has been updated accordingly.

Check All Checklist Items on an Issue (Node.js)

  1. Install Node.js

  2. Install required Node.js modules with following command:



  3. Save the content of script.js file provided below to your local filesystem:

    script.js

    The scripts reads Checklist Text value from your issue, checks every item and performs PUT request to JIRA to change value of Checklist Text field.
     

  4. Edit script.js file and change issueKeyjiraUrl and credentials as appropriate. 

  5. Type following command in the terminal:

     

  6. Go to your JIRA and selected issue page and see the Checklist modified by the script.