Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

REST API: What is the correct scope required to create an issue in Jira

atlassian-integration March 13, 2024

We are calling below API to create an issue in JIRA

POST: https://api.atlassian.com/ex/jira/6a5206af-e4a3-45b0-ad78-95d3070006af/rest/api/latest/issue/

 

But this is failing with below error.

{"code":401,"message":"Unauthorized; scope does not match"}

 

We are using accessToken to call this API and the scopes used are
"scope": "read:jira-work write:jira-work".

 

With the same set of scopes, this operation working until recent past (we dont from which date exactly, this started failing)

Is there any change happened in this area recently ? what are the right scopes to be used to call this API ?

2 answers

1 accepted

0 votes
Answer accepted
atlassian-integration March 14, 2024

The issue was with the trainling slash.,

I removed the slash from the api and it worked.

https://developer.atlassian.com/changelog/#CHANGE-1320

0 votes
Himanshi
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 13, 2024

Hello @atlassian-integration , 

Welcome to the community!

I highly doubt that this endpoint is correct : https://api.atlassian.com/ex/jira/6a5206af-e4a3-45b0-ad78-95d3070006af/rest/api/latest/issue/

As per the official documentation of Jira it does not have issue create endpoint with API/latest/issue.

Have you tried using Post Create issue  API call where in "your-domain.atlassian.net" is your instance name example - Testsite.atlassian.net :


curl --request POST \ --url 'https://your-domain.atlassian.net/rest/api/3/issue' \ --user 'email@example.com:<api_token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "fields": { "assignee": { "id": "5b109f2e9729b51b54dc274d" }, "components": [ { "id": "10000" } ], "customfield_10000": "09/Jun/19", "customfield_20000": "06/Jul/19 3:25 PM", "customfield_30000": [ "10000", "10002" ], "customfield_40000": { "content": [ { "content": [ { "text": "Occurs on all orders", "type": "text" } ], "type": "paragraph" } ], "type": "doc", "version": 1 }, "customfield_50000": { "content": [ { "content": [ { "text": "Could impact day-to-day work.", "type": "text" } ], "type": "paragraph" } ], "type": "doc", "version": 1 }, "customfield_60000": "jira-software-users", "customfield_70000": [ "jira-administrators", "jira-software-users" ], "customfield_80000": { "value": "red" }, "description": { "content": [ { "content": [ { "text": "Order entry fails when selecting supplier.", "type": "text" } ], "type": "paragraph" } ], "type": "doc", "version": 1 }, "duedate": "2019-05-11", "environment": { "content": [ { "content": [ { "text": "UAT", "type": "text" } ], "type": "paragraph" } ], "type": "doc", "version": 1 }, "fixVersions": [ { "id": "10001" } ], "issuetype": { "id": "10000" }, "labels": [ "bugfix", "blitz_test" ], "parent": { "key": "PROJ-123" }, "priority": { "id": "20000" }, "project": { "id": "10000" }, "reporter": { "id": "5b10a2844c20165700ede21g" }, "security": { "id": "10000" }, "summary": "Main order flow broken", "timetracking": { "originalEstimate": "10", "remainingEstimate": "5" }, "versions": [ { "id": "10000" } ] }, "update": {} }'


Another noticeable thing here is "email@example.com:<api_token>"

That should be user email address who holds Create issue permission within the project where you are attempting to create issue, verify if there is any security group/level setup should not be on the project where user is not part of.

The token should be generated from "https://id.atlassian.com/manage-profile/security".

If all these are taken care still you face an error then it is worth to create a ticket with Jira support As it might need extensive investigation on user setup and respective project config.

Hope this will help.

atlassian-integration March 14, 2024

Thanks for the response @Himanshi 

We are using OAuth 2.0 (3LO) apps

.
Exactly at this place in the documentation, a way to retrieve the cloud id is mentioned. Basically we have followed this.

And this approach (and API) was working in the expected way until last week.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events