Forums

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

unable to invoke Cloud Rest Call For Issue Search

Chakresh Tiwari November 14, 2019

I am Trying this 

/rest/api/3/search

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. Here Is my Code Sample- 

@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);
System.out.println("after Url---------------");
RestTemplate restTemplate = atlassianHostRestClients.authenticatedAsAddon();
ResponseEntity<String> responseEntity = restTemplate.getForEntity(builder.toUriString(), String.class);
atlassianHostRestClients.authenticatedAsAddon().getForObject(builder.toUriString(), String.class);
String responsetemp = responseEntity.getBody();
System.out.println("responsetemp--------------" + responsetemp);
return ResponseEntity.ok(responsetemp);

}

I tried another rest Calls also that are working But only this is not working.

It is giving this exception--

org.springframework.web.client.HttpClientErrorException: 400

Any Suggestion for Solving this Problem.

Thanks.

0 answers

Suggest an answer

Log in or Sign up to answer