Creating Issues via Jira API

 

NOTE: As this is related to the Jira Cloud REST API, it falls out of JEMHC scope - this page is used to clear up confusion on how API calls trigger events that JEMHC can process/send notifications for.

Use case

Sometimes, issue creation and updates are done using Jira REST calls. The important thing to note here, is that when the Jira REST API is used, JEMHC is not handling the request.

For example, when JEMHC processes an inbound mail from an external non-jira address configured to create issues and upload found attachments, this will all be handled by JEMHC - Custom Fields will be set, Attachments uploaded to the issue, and the matching values set in your JEMHC profile will be used in the newly created/commented issue.

However, if JEMHC is used for just notifying issue events, then the API requests made must handle setting these values/attachments in order for webhook events containing these changes to be fired.

 

 

Attachments via Jira API

If you are trying to add attachments via API call:

<HOST> - Your Atlassian host environment. E.g. our support host is ‘thepluginpeople.atlassian.net

<Email>- The Email for the Jira Email user you have configured an API token for.

<API Token> - The API token for the Jira email user - See https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/ for more information.

<Filename> - The file attachment (and directory location) you want to upload (File extension is also required)

curl --location --request POST \ 'https://<HOST>.atlassian.net/rest/api/3/issue/SVC-1/attachments '-u \ '<Email>:<API Token>'-H 'X-Atlassian-Token: no-check' --form 'file=@"<Filename>"'

For more information - https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-issue-issueidorkey-attachments-post

 

Custom Fields via Jira API

If you are trying to add populate custom fields via API call:

<HOST> - Your Atlassian host environment. E.g. our support host is ‘thepluginpeople.atlassian.net

<Email>- The Email for the Jira Email user you have configured an API token for.

<API Token> - The API token for the Jira email user - See https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/ for more information.

<Custom Field ID> - The ID of the Custom Field to change

<ISSUE IDS CSV> - CSV split ID’s of the Issues to change (These would be the IDs of the created issues)

<NEW VALUE> - The new Custom Field value you want to set

curl --request PUT \ --url 'https://<HOST>.atlassian.net/rest/api/3/app/field/<Custom Field ID>/value' \ --user '<Email>:<API Token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "updates": [ { "issueIds": [ <ISSUE IDS CSV> ], "value": "<NEW VALUE>" } ] }'