Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • Community
  • Q&A
  • Jira
  • Questions
  • Can I populate a select list or user picker field with a user group using a workflow property?

Get request

Pradeep A
Contributor
July 23, 2021

Hi I'm working on a project which involves API calls. I was able to perform the Post api successfully but I'm getting 400 error for the GET request. I have tried so many times but still i'm getting the same error. Any solutions?

 

My Code

String targetURL = 'https://graph.microsoft.com/v1.0/users/pradeep@avaMigration.onmicrosoft.com'
try {
URL restServiceURL = new URL(targetURL);
HttpURLConnection httpConnection = (HttpURLConnection) restServiceURL.openConnection();
httpConnection.setRequestMethod("GET");
//httpConnection.setRequestProperty("Accept", "application/json");
httpConnection.setRequestProperty("Authorization", "Bearer " + "the token);

if (httpConnection.getResponseCode() != 200) {
throw new RuntimeException("HTTP GET Request Failed with Error code : "
+ httpConnection.getResponseCode());
}

BufferedReader responseBuffer = new BufferedReader(new InputStreamReader(
(httpConnection.getInputStream())));

String output;
log.debug("Output: \n");

while ((output = responseBuffer.readLine()) != null) {
return output;
}

httpConnection.disconnect();

} catch (MalformedURLException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

}

 

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
June 11, 2015

You could try it with a lot of code.

Or just set the context for a user picker field and use the built in "only show people from group/role(s)" function (it's a more recent function, so you need to be on quite a recent JIRA to have it)

werner kolze
June 18, 2015

we are on Jira 6.3.15 - but I cannot find this function, would you be so kind and explain how to find this new function?

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
June 18, 2015

Custom fields -> the field -> configure will take you to the context list. Find the context you're interested in (there's often only a single one), and it's in there

Suggest an answer

Log in or Sign up to answer