Reach work item data using REST & API token for a service account

Hello Guys,

I’m able to do /rest/api/3/issue/ request using my persolan api token, however when i’m trying to configure postman same way for a service account i only got 404 with the below error:

{

"errorMessages": \[

    "Issue does not exist or you do not have permission to see it."

\],

"errors": {}

}

Can anybody help me to configure postman to reach the issue data using service account API Token? How to configure Authentication correclty?

Already tried:

Hello @JacekOstrowski3

Service Accounts are pre-authenticated using OAuth 2.0, so the path to the API endpoint is constructed differently to Basic Auth for personal API tokens.

Refer to the Other Integrations part of the Authentication and authorization section of the Jira Cloud REST API documentation for information about the OAuth 2.0 URI structure.

1 Like

@sunnyape Thanks! Your comment helped. Hovewer i have the same problem with other API:

/rest/servicedeskapi

I have changed the URI like this below:

https://api.atlassian.com/ex/jira/<JIRA_CLOUD_ID>/rest/servicedeskapi/organization?start=0&limit=499

And again It worked for my personal key (even above URL), but is not for token and barer/oAuth2. Do you know how to use my service account token with /rest/servicedeskapi ?

Hello @JacekOstrowski3

First, if my prior answer was correct, please mark it as such.

With regards your new, additional question about using Service Accounts with JSM and what you’ve said in your first question, I am going to assume that when you created the Service Account, you configured it with OAuth 2.0 credentials, not Token credentials.

If that is the case, then using a URI with the structure api.atlassian.com/ex/jira/{cloudid}/rest/servicedeskapi/{resource-name} is the correct method for JSM’s REST API endpoints.

If you are still getting 401 / 404 permission errors when accessing JSM endpoints, then it’s 99% most likely that you haven’t added the required JSM OAuth SCOPES to the credentials of that Service Account. Remember, JSM has its own, separate scopes to Jira, so to access the Get organizations endpoint, the Service Account would need the read:organization:jira-service-management scope in its credentials list.