You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hi, I wanted to get all the users through our JIRA and Confluence access using python REST API. Can you please suggest the best way to pull all user details from the platforms? Most vital elements required are the Names and email addresses.
@Rishi Jain Welcome to the community!
You have couple of ways to do this,
Thanks for your response. I could checkout API options where Get All Users needs admin access which I do not have and Bulk Get User needs user IDs to get other user details.
Holding a regular access, is there an API request which can allow me to fetch all user names and email addresses of the users in our network?
Also, if you can please share specific REST API url and method which can help me complete this task?
@Rishi JainYou don't need to be admin, you will just need Browse users and groups permission in your Jira.
API that you can use are,
Thanks for helping out again. The first link request "account id" to be passed - is this the account id of my user account for authentication purpose or the account id of user I need to pull the details for (in the latter, I need all account id's first, how do I get them all?)
In the second one, a query needs to be passed, what kind of query it needs? if I need to pull an email list and pass that on, then I do not get an opportunity to find the universe of users from my organization standpoint who have access to the platform.
Please advise how to structure any of these to get me all user details without any specific inputs.
Oh! my bad I guess linking got mixed up, API I was talking about is,
It will just need pagination data.
Now, for your knowledge, accountId parameter in API that I gave you previously was id of user of which you want to fetch information.
On second API, query parameter is kind of a search term, that will search into user's email and display name. I used this API to search for all my organization users by giving value of query parameter as 'YOUR_COMPANY_MAIL_DOMAIN', this will give you all use who have email id as, 'EMAIL_NAME'@'COMPANY_MAIL_DOMAIN'
Hi @DPKJ , thanks for your help, the API did work and it is fetching me user accounts, however, I am receiving account IDs and Names of the users. I was hoping if the email id's were also a part of this API output since it is a user information itself. Please advise how to get that aswell through my outputs?
Also, instead of pagination i am using startAt and maxLength to fetch all the users. If there a way also to determine the number of users in total so I can make the maxLength a dynamic value?
Please advise and thanks again for all your help.
Update: while getting users using:
I am getting a 400 response for email request API calls, the text version of response says "Requestor must be a whitelisted app (not a user)." Please advise how to work around with this?
@Rishi Jain Oh! I forgot to mention both these API are in experimental tag, so to use them you need to build a app using Atlassian Connect ( https://developer.atlassian.com/cloud/jira/platform/getting-started/ )
There is no work around experimental API as of now.
I would suggest
Unless your Jira has more than 1000 users that should give you all of the users. The REST API version 3 is still in Beta and you apparently have to go through some effort to get it working.
@Mark Thank you for pointing out this option to do the query by using API v2.
This saved my day, as I cannot use API v3 in our environment.
As @Evgen Kyselgov pointed out, it would be nice if the documentation would describe how the username parameter is used to find user and what the '.' means.
See Documentation: Jira 9.11.0 (atlassian.com)
As I have a Jira environment with more than 1000 users, I played around with the startAt parameter, like:
This worked, but it threw an "500 Internal Server Error" at the point where startAt + maxResults exceeded the count of users in my environment
In my case:
/api/2/user/search?username=.&maxResults=1&startAt=3965&includeInactive=true failed with a 500 Error Code
I hope this information might be useful for someone else.