How to get the User Profile information using JIRA Rest API?

HSNAN January 17, 2019

Hi,

Is it possible to get the below details for all the users in JIRA using Rest API?

                                Capture.PNG 

 

3 answers

0 votes
Akeel Ahmed April 5, 2024

Hey so I managed to get the data using grapghql (use with caution as I didnt see it documented, i sniffed the page)

Post to URL: https://{sitename}/gateway/api/directory/graphql?q=UserDetails

Query:

query UserDetails($userId: String!, $cloudId: String!) {
  CloudUser(userId: $userId, cloudId: $cloudId) {
    id
    fullName
    isCurrentUser
    title
    department
    companyName
    location
    timezone
    email
    phoneNumber
    remoteWeekdayIndex: localTime(format: "d")
    remoteWeekdayString: localTime(format: "ddd")
    remoteTimeString: localTime(format: "h:mma ([GMT]Z)")
    __typename
  }
}

Varaibles:

{
  "cloudId": "",
  "userId":"{accountId of user}"
}  You can get the accountId for users from /rest/api/3/users
Jigar Baraiya April 5, 2024

Hi Akeel,

Can you please share sample postman curl?

Akeel Ahmed April 5, 2024
curl --location 'https://{siteurl}/gateway/api/directory/graphql?q=UserDetails' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {your auth}' \
--data '{"query":"query UserDetails($userId: String!, $cloudId: String!) {\r\n  CloudUser(userId: $userId, cloudId: $cloudId) {\r\n    id\r\n    fullName\r\n    isCurrentUser\r\n    title\r\n    department\r\n    companyName\r\n    location\r\n    timezone\r\n    email\r\n    phoneNumber\r\n    remoteWeekdayIndex: localTime(format: \"d\")\r\n    remoteWeekdayString: localTime(format: \"ddd\")\r\n    remoteTimeString: localTime(format: \"h:mma ([GMT]Z)\")\r\n    __typename\r\n  }\r\n}\r\n","variables":{"cloudId":"{yourCloudID}","userId":"{yourUserId}"}}'
Jigar Baraiya April 5, 2024

Lovely, This is working like a charm. Thanks a lot.

Is there any way, we can get profile info for all the active users?

0 votes
SUMER SOVITKAR April 3, 2023

Hello , 

 

I have same situation where I need to output as users role , department and location.

0 votes
Arun_Thundyill_Saseendran
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.
January 17, 2019

Hi @HSNAN

It is possible. You could playground with the groups API to get all the users of a particular group and then loop through each user to get all their profile information.

 

Groups API

https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/group

Users API

https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/user

 

Do let us know if you face any specific issues.

 

Thanks

Arun

HSNAN May 23, 2019

Hi Arun,

I want the user information from the screenshot provided above. not sure how to achieve this from Groups API. 

I am using the following Users API to fetch user details within my organisation. The API returns only few columns but not what i want. 

https://xyz.atlassian.net/rest/api/2/user/search?username=%

Like # people like this
Danilo de Nadai Sicari December 7, 2021

@HSNAN Did you have any updates?

Bruno Frade October 11, 2022

Would also know if there are any updates to this

Jigar Baraiya January 18, 2023

APIs are still not returning the info as per @HSNAN 's screenshot. However need to try the solution provided here: 

https://confluence.atlassian.com/jirakb/how-to-get-jira-user-information-with-roles-and-groups-in-an-automated-way-1108488336.html

Nikhil Dhiman September 16, 2023

Hey Guys,

Did you able to figure out API endpoint using which we can get above info ?

Suggest an answer

Log in or Sign up to answer