Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

JIRA Rest API returns proper group count, but not group names

Luis Luis February 11, 2012

JIRA 4.4.3

Making a call to the REST Api via:

http://jira.composersconcordance.com/rest/api/2.0.alpha1/user?username=lcobo

returns results that show the correct number of groups but a consistently empty group names list:

{"self":"http://jira.composersconcordance.com/rest/api/2.0.alpha1/user?username=lcobo","name":"lcobo","emailAddress":"webmaster@composersconcordance.com","avatarUrl":"http://jira.composersconcordance.com/secure/useravatar?size=large&ownerId=lcobo","displayName":"Luis Andrei Cobo","active":true,"timeZone":"America/New_York","groups":{"size":4,"items":[]},"expand":"groups"}

Notice how the groups size = 4, but items is blank. I read the documentation and it says I should be getting back the names of the groups. This is the call I am making via PHP:

<?php
header("Content-Type: application/json");
$username = $_REQUEST["username"];
$password = $_REQUEST["password"];


$url2 = "http://jira.composersconcordance.com/rest/api/2.0.alpha1/user?username=".$username;
$ch = curl_init();

$headers = array(
'Accept: application/json',
'Content-Type: application/json'
);
curl_setopt($ch,CURLOPT_HEADER, $headers);
curl_setopt($ch,CURLOPT_URL,$url2);
curl_setopt($ch,CURLOPT_USERPWD,$username.":".$password);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Dieter
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 Leaders.
February 11, 2012
Hi Luis, you should add the parameter expand=groups to get details about the groups. Use this query http://jira.composersconcordance.com/rest/api/2.0.alpha1/user?username=lcobo&expand=groups
Luis Luis February 11, 2012

Thanks! Didn't realize. This works great. !!!

TAGS
AUG Leaders

Atlassian Community Events