Forums

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

I am accessing url : https://hibu-us.atlassian.net/rest/api/2/search with api key. Body: {"jql":"pr

Deleted user September 9, 2020


I am accessing url : https://hibu-us.atlassian.net/rest/api/2/search with api key.
Body: {"jql":"project = DIG","startAt":0,"maxResults":2,"fields":["id","key"]}
getting error
{
"errorMessages": [
"The value 'QA' does not exist for the field 'project'."
],
"warningMessages": []
}

Note: Able to access same in local Jirra running in Docker. Is any difference for clould jirra project :: value.
Jqul project value given as DIG, which is id of existing Hibu account project. But response is error.
Please help

3 answers

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 16, 2020

That 401 error is a pretty clear indicator that you can't use just the username and password for authorization here.  The link to the deprecation notice is more evidence of this.  Jira Cloud once allowed this, but not since last year.

Instead please take a closer look at Basic auth for REST APIs when trying to make such REST calls to the Cloud platform.  You are going to need to create a string of

emailaddress:API_token

and then base64 encode that string.  Only then can you use the base64 encoded string as part of an authorization header that can be passed in your REST call.  This will make sure that your request is being authorized correctly and in turn should help correct this.

Let me know if you run into any problems with this.

Andy

0 votes
Deleted user September 14, 2020

Hi Andy Heinzer

i am using POST call.

Tried with GET on  /rest/api/3/search.  and  /rest/api/2/search. both didn't thrown error, but no data pulled in response.

{    "startAt": 0,    "maxResults": 50,    "total": 0,    "issues": []}

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 14, 2020

That is not entirely unexpected, if the REST call is not authenticated it is very likely you would get 0 results.  The search endpoints are accessibly anonymously, but Jira won't return any results that your account does not have access to view.  Tell me more about how you are authenticating these REST API calls; basic auth? OAuth?

Deleted user September 15, 2020

API key authorization with Key/Value and Add to< Header>. Showing green on Authorization.

API Key generated in jirra account for my id.

But status shows as Bad request:400 Bad Request - The request cannot be fulfilled due to bad syntax

Request: {"jql":"project = PSP","startAt":0,"maxResults":2,"fields":["id","key"]}

Same request working with local docker jirra and giving response.

Local docker jirra search url: http://192.168.99.100:8080/rest/api/2/search/

192.168.99.100 - Local docker IP. [ Note for local auth using user/pwd working fine,

When i use HibucloudAtlassianJirra - User/pwd giving error only Auth Key working.

User/pwd error: 401:Unauthorized Basic authentication with passwords is deprecated. For more information, see: https://confluence.atlassian.com/cloud/deprecation-of-basic-authentication-with-passwords-for-jira-and-confluence-apis-972355348.html

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 10, 2020

Hi Easwaran,

If I understand correctly, you are trying to make a REST API call to search for some issues in Jira Cloud.  However the error you are getting back is usually an indication of one or more problems with the request, such as:

  1. The project does not exist
  2. Your account does not have access to browse that project
  3. Or the REST API call is not authenticated correctly here

That error message is vague enough that we don't know for sure if this is a permissions issue or authentication problem.  Jira is intentionally vague here in order to not disclose information to users that don't have access to it.

That said, tell me more about your REST call.  Is this using the GET or the POST verb?  The REST API for search is only of the few endpoints that can use either when searching.  Our documentation explains that POST is sometimes needed when the JQL query is large.  And while I would not expect to see a difference here between them, in my own testing of at least one Cloud site, I found that I too got this error when using the POST to search a project, but not when using the GET verb.  There are more details on using the GET verb for this endpoint in GET /rest/api/3/search.  (UPDATE: turns out that the difference in my case was I was looking at the wrong Cloud site where that project didn't exist yet)

So that is the first thing to check.  If that doesn't help then the next thing would be for us to try to understand what means of authentication you are using to make this REST API call (Basic auth, OAuth, etc).  I don't want to see your password/token, but I would like to try to better understand what your API call looks like in detail to see if I can recreate this problem.

Andy

Suggest an answer

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

Atlassian Community Events