Using Forge to Manage Issue Labels

Hey folks,

I am looking at a way to update issue labels from a forge app. I can see I should be using @forge/api and api.asApp().requestJira() and include the route, but I don’t see any examples on how to post to this with a label or set of labels that I want to include with the issue.

Any and all help is greatly appreciated!
Regards,
Bruber

Hey Bruce!

Forge just provides with an API to make requests to public Jira REST API. So in order to update labels you have to refer to Jira REST API docs.

Here is how you should update the labels:

fetch(route`/rest/api/3/issue/${issueIdOrKey}`, {
  method: 'PUT',
  body: JSON.stringify({
    fields: {
      labels: ['2', 'a']
    }
  })
})

Thanks,
Vitalii

3 Likes