Trying to make a GET request to the REST API using Jira API token. Works on the browser through google extensions using the SAME token. I literally copied the request to make sure I was not messing something up. Yet, it doesn't work still.
My request:
Method: GET,
URL: https://jiracloud.COMPANY.com.br//rest/api/2/search?fields=fields,key&jql=worklogAuthor=currentUser(),
Headers: {
"content-type": "application/json",
"cache-control": "no-cache",
"app_token": "myToken"
}
Through the browser and/or Google Extensions that makes this same request I receive:
Status: 200
Through Postman or any code OUTSIDE the browser:
Status: 400,
Error: "Field 'worklogAuthor' does not exist or this field cannot be viewed by anonymous users."
I tried everything I could think of, don't know what else to do. Tried even using the the same "User-Agent" and Cookies as the browser uses to make the request...What am I missing? It must be something really obvious.
Thanks
The reason that you're able to make API calls from your browser is because of the session data stored in cookies. Replicating the exact cookie jar and request details coming from your browser in a REST API client like Postman isn't an exact science.
The recommendation would be to use basic authorization for making REST API calls in Postman.
If you're running Jira Server (on-prem): https://developer.atlassian.com/server/jira/platform/basic-authentication/
If you're making a call against Jira Cloud, you'd use basic auth but with an API token:
https://developer.atlassian.com/cloud/jira/software/basic-auth-for-rest-apis/
Thank you. If possible can you give me a hint on how can I find out if I'm dealing with Jira server or Jira Cloud? From the url of my company it seems like I'm dealing with cloud, since it's `jiracloud.mycompany.com`. Am I correct or there's another way to find this out?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bruno Mayol Giannoti sure.. just hit the /rest/api/2/serverInfo endpoint, and if you see deploymentType: "Cloud" then it's a cloud instance.
For example: https://ecosystem.atlassian.net/rest/api/2/serverInfo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.