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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

REST API to get all users overall

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. 

1 answer

1 accepted

0 votes
Answer accepted
DPK J Community Leader Feb 07, 2020

@Rishi Jain  Welcome to the community!

You have couple of ways to do this,

  1. Standard rest API, using library of your choice to call that rest (unirest is really nice)
  2. Second way of using python library

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?

Hi DPK,

 

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. 

 

Best,

Rishi Jain

DPK J Community Leader Feb 07, 2020

Oh! my bad I guess linking got mixed up, API I was talking about is,

https://developer.atlassian.com/cloud/jira/platform/rest/v3/?#api-rest-api-3-users-get

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 @DPK J , 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:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-user-email-get

or

https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-user-email-bulk-get

 

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?

 

Best Regards

Rishi Jain

DPK J Community Leader Feb 12, 2020

@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.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you