I am trying to read jira issue via API.I created PAT without scope and the API works fine.curl -u jira_email:PAT_without_scope -X GET "https://my-jira-space.atlassian.net/rest/api/3/issue/issue-id"
I create PAT with scope and I get error message:
curl -u jira_email:PAT_with_scope -X GET "https://my-jira-space.atlassian.net/rest/api/3/issue/issue-id"
{"errorMessages":["Issue does not exist or you do not have permission to see it."],"errors":{}}%
Scope applied:
Hi @Jamiu Adeleke
Welcome to the community.
Can you access this issue via the GUI?
If not, the error is correct, because it means you don't have access to the issue in that project.
Hello @Jamiu Adeleke
@Jamiu Adeleke Welcome to Atlassian Community!
API tokens with specific scopes are tied to OAuth 2.0 (3LO) and cannot be used directly with standard Jira REST API endpoints.
To use OAuth 2.0 tokens, you'll first need to construct the request using the appropriate resource URL that includes your Cloud ID, as outlined in the documentation:🔗 Enabling OAuth 2.0 (3LO) for Atlassian Cloud
Your API endpoint should look like this:
https://api.atlassian.com/ex/jira/{cloudid}/rest/api/3/issue/{issueIdOrKey}
You can also retrieve the cloudid following the steps mentioned in this Atlassian guide.
Finally, you should include read:jira-work Classic scope to the token as recommended by others. A working curl command would look something like,
curl --request GET \--url 'https://api.atlassian.com/ex/jira/{cloudId}/rest/api/3/issue/{issueIdOrKey}' \--user 'email@example.com:<api_token>' \--header 'Accept: application/json'
Thanks Akash, I will check it again today.
@Jamiu Adeleke Were you able to resolve the issue? If so, kindly mark my answer as accepted, it helps others in the community find the solution more easily.
I am also having this exact issue - I have access to the project and issues in the GUI and can successfully post stories in our sandbox Jira environment, but I cannot get an issue in our production instance to be retrieved, I even tested it with a PAT made with only the scopes required for that 1 endpoint and it gave me the same error message in 2 different projects I have access to normally. Just this one endpoint is giving me issues
Thanks @Akash Singh ,
This really help to solve my problem. I initially followed the jira document and try the example by a PAT with scope but it return nothing. It only work when I use API without scope. Now it work by change the url like your suggestion.
The Jira Cloud platform REST API
It looks like you're new here. Sign in or register to get started.