Jira (Apps step)
Jira
Finds, creates, updates and comments on Jira Cloud issues.
Use it to raise, find and update Jira issues from a workflow: a ticket for every failed inspection, a comment when a shipment leaves, or a daily list of open issues for a report.
Beta. This step has not yet been checked against a live Jira account, so treat its first runs as a test, and tell us if an operation does not answer as described.
Find it in the workflow editor's palette under Apps. See Apps steps for what every Apps step has in common.
Set it up
- In Atlassian, open Account settings › Security › API tokens and create an API token.
- In DataMagik, open Script Engine › Credentials and add a "Basic Auth (Username/Password)" credential: your Atlassian email as the username and the API token as the password.
- Add your site's host (such as acme.atlassian.net) to Allowed Domains in the workflow's Script settings.
Credential: A Basic credential: your Atlassian email as the username and an Atlassian API token as the password.
Hosts it calls: *.atlassian.net
Connection
| Field | Required | What to put |
|---|---|---|
| Site | Yes | The part of your Jira address before .atlassian.net: acme for acme.atlassian.net. For example acme. |
Operations
| Operation | What it does |
|---|---|
| Issue › Search (JQL) | Finds issues with a JQL query, following every page up to the step's page limit. |
| Issue › Get | Reads one issue by its key or id. |
| Issue › Create | Creates an issue in a project. |
| Issue › Update | Changes an issue's summary or labels. |
| Comment › Add | Adds a comment to an issue. |
| Project › List | Lists the projects the account can see. |
Issue › Search (JQL)
Finds issues with a JQL query, following every page up to the step's page limit.
Calls GET /search/jql. Follows the pages, up to Most pages (10 unless you change it).
| Field | Required | What to put |
|---|---|---|
| JQL | Yes | The query, as in Jira's advanced search. For example project = QA AND status != Done. |
| Fields to return | No | Comma-separated field names; *all returns every field. |
| Page size | No | Issues per request (Jira's limit is 100). For example 50. |
What comes out: One item per issue: {{ $json.key }} (QA-12), {{ $json.id }}, and {{ $json.fields }} with the fields asked for, such as {{ $json.fields.summary }} and {{ $json.fields.status.name }}.
Example: JQL project = QA AND created >= -1d lists yesterday's quality issues for a daily summary email.
Issue › Get
Reads one issue by its key or id.
Calls GET /issue/{issueKey}.
| Field | Required | What to put |
|---|---|---|
| Issue key | Yes | The issue's key (QA-12) or numeric id. For example QA-12. |
| Fields to return | No | Comma-separated field names; *all returns every field. |
What comes out: One item: the issue, with {{ $json.key }}, {{ $json.id }} and {{ $json.fields }}.
Example: Read {{ $json.jira_key }} to check whether its status is Done before closing the matching NCR.
Issue › Create
Creates an issue in a project.
Calls POST /issue.
| Field | Required | What to put |
|---|---|---|
| Project key | Yes | The project's key, the letters before the number in its issue keys. For example QA. Choose from list beside the field fetches the choices from your account. |
| Issue type | Yes | The issue type's name as Jira shows it: Task, Bug, Story… |
| Summary | Yes | The issue's title. |
| Labels | No | A JSON list of labels. For example ["plant-1"]. |
What comes out: One item: {{ $json.id }}, {{ $json.key }} (the new issue's key, such as QA-13) and {{ $json.self }} (its API address).
Example: Create a Bug in QA with summary Scrap over limit: {{ $json.part_no }}, then save {{ $json.key }} on the part's lookup table row.
Issue › Update
Changes an issue's summary or labels.
Calls PUT /issue/{issueKey}.
| Field | Required | What to put |
|---|---|---|
| Issue key | Yes | The issue's key (QA-12) or numeric id. For example QA-12. |
| Summary | No | The issue's title. Leave empty to keep it. |
| Labels | No | A JSON list of labels; it replaces the issue's labels. Leave empty to keep them. For example ["plant-1"]. |
What comes out: Jira answers an update with no content, so the step puts out one item holding {{ $json.status }} (204 when it worked).
Example: When the NCR is closed, update {{ $json.jira_key }} with the label closed-in-plex.
Comment › Add
Adds a comment to an issue.
Calls POST /issue/{issueKey}/comment.
| Field | Required | What to put |
|---|---|---|
| Issue key | Yes | The issue's key (QA-12) or numeric id. For example QA-12. |
| Comment | Yes | The comment in Atlassian Document Format: a doc with one paragraph holding your text, as in the placeholder. For example {"type": "doc", "version": 1, "content": [{"type": "paragraph", "content": [{"type": "text", "text": "Shipped on {{ $json.shipper }}"}]}]}. |
What comes out: One item: the new comment, with {{ $json.id }} and {{ $json.created }}.
Example: When shipper {{ $json.shipper }} is confirmed, comment on the customer's issue with the tracking number.
Project › List
Lists the projects the account can see.
Calls GET /project/search. Follows the pages, up to Most pages (10 unless you change it).
| Field | Required | What to put |
|---|---|---|
| Name contains | No | Only projects whose name or key contains this text. Leave empty for all. |
What comes out: One item per project: {{ $json.key }} (QA), {{ $json.name }}, {{ $json.id }} and {{ $json.projectTypeKey }}.
Example: List the projects to check which key to raise quality issues in.
Trigger: Jira: New Items
Under Triggers in the palette. It looks at Jira on a schedule (every 15 minutes unless you change Look every) with one of these operations: Issue › Search (JQL); Project › List, and starts the workflow with the items it has not seen on an earlier look, one item each. Saving the workflow sets up the schedule.
- New means: not seen before, by the item's id (or the field you name in Item field), or newer than the newest one last time, by a date or increasing number.
- On the first run it only remembers what is there, unless you choose Start with everything.
- Test runs show what would be new without remembering it. It remembers the last 5000 ids, so filter the list to keep it shorter than that.
Example
A Plex Data Source lists today's scrap over 2%; Jira › Create issue raises one Bug per part in project QA with the part number and scrap rate in the summary.
Tips
- Search takes JQL, the same query language as Jira's advanced search: project = QA AND status != Done ORDER BY created DESC.
- The description is plain text here; Jira stores it as a single paragraph.
- Custom fields (customfield_10011…) go in "More body fields", such as {"fields": {"customfield_10011": "{{ $json.lot }}"}}; it is merged with the fields above.
- It calls Jira on test runs too, so create issues in a test project while building.
Settings every Apps step has
- More query parameters: any query parameter the fields do not offer, sent as is.
- More body fields: a JSON object merged into the request body; nested objects merge, other values replace.
- Most requests per second: spaces the calls out for rate limits. A "too many requests" (429) answer is retried after the wait the API asks for.
- Most pages: for operations that follow pages, the most pages to fetch (10 unless you change it, up to 100). The run warns when it stops with more to get.
- Fail on a non-2xx response: on by default. Turn it off to handle errors yourself.
Jira's own API documentation: https://developer.atlassian.com/cloud/jira/platform/rest/v3/