cloud Rest call for getting data by passing JQL as Parameter. But Every time it is returning 400 status Code which means invalid JQL But I tried JQL in Jira where it is returning Correct Response. I tried Resttemplate For Client.
/rest/api/3/search
@Chakresh TiwariCan you please elaborate and share query you are trying to pass, because it seems error is in JQL you are passing or how you are passing it.
Hi @Chakresh Tiwari
Totally agree with what @DPKJ has said above - it would be useful to see the JQL query (anonymised if required). Does the API call work for you without passing in a JQL at all? i.e does
work or return an error?
Hi i am Using this rest api for getting IssueCount using Resttemplate. for every other api i am getting a response but for only this i am getting 400 status code.
@GetMapping("issueCount")public ResponseEntity<String> getIssueCount(@AuthenticationPrincipal AtlassianHostUser hostUser,@RequestParam("jql") String jql) {AtlassianHost host= hostUser.getHost();UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(host.getBaseUrl() + ConstantsInf.issueSearch).queryParam("jql",jql);System.out.println("-------------- URL " + host.getBaseUrl() + ConstantsInf.issueSearch);RestTemplate restTemplate = atlassianHostRestClients.authenticatedAsAddon();ResponseEntity<String> responseEntity = restTemplate.getForEntity(builder.toUriString(), String.class);atlassianHostRestClients.authenticatedAsAddon().getForObject(builder.toUriString(), String.class);String responsetemp = responseEntity.getBody();return ResponseEntity.ok(responsetemp);}
I passed correct Jql still it is giving error. like this
assignee = admin
and
project =Demo
Thanks For your reply .
I am Passing Correct JQl which is working on Jira but while doing that through api that is not working.
. like this
Without passing JQL it is returning response but with JQL it has error.
without JQL it is returning response but with jql returning 400 where is my Jql Incorrect or some other problem??
Okay, that's good news (sort of) because it means everything is working apart from the JQL.
I may be wrong but I think you're passing in the JQL incorrectly. It should be part of the API call, so it should look like this for your query
/rest/api/3/search?jql=assignee=admin and project=demo
whereas you seem to be passing the JQL in as a parameter
It looks like you're new here. Sign in or register to get started.