Hi all,
I am migrating our application to leverage the enhanced JIRA search endpoint (/rest/api/3/search/jql). We previously used the now deprecated /rest/api/3/search/ endpoint which gave us responses matching the corresponding results from the same JQL query in the JIRA web search window. We currently receive 200 status from hitting the advanced search endpoint, but we get no data for all queries. Even the most basic queries return an empty issues list. We know these queries are valid since they generate results in the web page search still. Our test setup is that of the JQL advanced search v3 API docs demo, and given the 200 status I know it is not a matter of invalid credentials.
This is the response no matter what the query is- and we verify all queries with a search on the web page:
{ "isLast": true, "issues": [] }
I think the issue might be with the fields
or expand
parameters - in the v3 API you often get an empty array if no fields are specified. Try adding something like fields=summary,key
(or whichever fields you need), and the response should start returning data.
Hey Vitalii,
We are already requesting fields. This is the request payload setup for our test:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Garrett Kaufmann, I would like to clarify. Do you use Forge env or Node.js env?
According to the docs, there are several important notes:
Permissions required: Issues are included in the response where the user has:
Browse projects project permission for the project containing the issue.
If issue-level security is configured, issue-level security permission to view the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We are using the requests library for HTTP in Python 3.10.12. We are using a generic token with no permission restrictions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Update: tried the same jql query with the same fields for a POST request, got a 200 response but empty issues array this time too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sounds pretty weird. I believe you should try a very simple request with only one field. Here is an example from the docs:
# This code sample uses the 'requests' library:
# http://docs.python-requests.org
import requests
from requests.auth import HTTPBasicAuth
import json
url = "https://your-domain.atlassian.net/rest/api/3/search/jql"
auth = HTTPBasicAuth("email@example.com", "<api_token>")
headers = {
"Accept": "application/json"
}
query = {
'jql': 'project = HSP',
'nextPageToken': '<string>',
'maxResults': '{maxResults}',
'fields': '{fields}',
'expand': '<string>',
'reconcileIssues': '{reconcileIssues}'
}
response = requests.request(
"GET",
url,
headers=headers,
params=query,
auth=auth
)
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Vitalii Rybka We've tried this already, but for sanity's sake I just tried again to no avail. To confirm, the fields attribute should be
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Vitalii Rybka I tried with a few different projects, and none return data.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We fixed the issue by rotating the token.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.