When I am writing query through UI
updatedDate >= -1d or createdDate >= -1d order by created DESC
query works - returns all work items changed or created in the last day.
When I use this query in Springboot
return objectMapper.readTree(atlassianHostRestClients.authenticatedAsAddon(atlassianHostRepository
.findById(clientKey).get())
.getForObject(url, String.class));
where url is
"/rest/api/3/search/jql?updatedDate>=1d or createdDate>=-1d order by created DESC&fields=summary,description,status,creator,reporter,type,assignee,due,created,updated&maxResults=5000";
I get
400 Bad Request: "{"errorMessages":["Unbounded JQL queries are not allowed here. Please add a search restriction to your query."],"errors":{}}"
Any ideas ? What am I missing ?
@Nenad Crnčec - welcome to the Atlassian Community!
The Jira Cloud REST API has stricter requirements than the UI (hence why it's working in the UI), specifically, the API will reject "unbounded" queries (which are queries without restrictions like project, issue key, or other elements to narrow the query's execution).
So you need to bound the query, for example by restricting it to a specific project, like this:
/rest/api/3/search?jql=project=INSERT YOUR PROJECT NAME HERE and (updatedDate>=-1d or createdDate>=-1d) order by created DESC&fields=summary,
description,status,creator,reporter,type,assignee,due,created,updated&maxResults=5000";
Correct.
The reason why the query works in the UI is because JQL searches can only be performed from within the context of a Project, so that Project is the boundary (scope) of the query.
This is described in the documentation for the Search for Issues using JQL endpoint:
order by key desc
.assignee = currentUser() order by key
.You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And welcome to the community.
I think you should URL encode this
updatedDate>=1d or createdDate>=-1d order by created DESC
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.