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

Api to fetch users, add user, fetch billing details common to all Jira products

i would like to know if there is an common api for fetching users of all Jira products , adding users, fetching billing related information, https://developer.atlassian.com/cloud/ ,I have checked this documentation I cant find specific resource to fetch users , add user and billing related information.

1 answer

1 vote
Prince Nyeche Community Leader Feb 22, 2021

Hi @divya 

Welcome to community! You can use the users api  to fetch users and add users in your instance. However, regarding billing related information. Are there any specific information you're looking for?

is this "users" common to all JIRA products? and billing related information such as amount , plan name ,bill date, and other licensing related information(expiry ,renewal dates) is needed for fetching through api.

And the mentioned Api returns some unwanted information (different apps as users)along with the users list

{
"self": "https://*******.atlassian.net/rest/api/3/user?accountId=*******b9320d9ea5bdc2",
"accountId": "*******b9320d9ea5bdc2",
"displayName": "Jira Outlook",
"active": true
},
{
"self": "https://*******.atlassian.net/rest/api/3/user?accountId=*********52030f1e3a5905",
"accountId": "*******52030f1e3a5905",
"accountType": "app",
"displayName": "Jira Spreadsheets",
"active": true
},
{
"self": "https://*******.atlassian.net/rest/api/3/user?accountId=*******950f9f5b-3d6d-4e1d-954a-21367ae9ac75",
"accountId": "******e9ac75",
"accountType": "app",
"displayName": "Jira Service Management Widget",
"active": true
},
{
"self": "https://*******.atlassian.net/rest/api/3/user?accountId=*******:f58131cb-b67d-43c7-b30d-6b58d40bd077",
"accountId": "************3c7-b30d-6b58d40bd077",
"accountType": "app",
"displayName": "Automation for Jira",
"active": true
},
{
"self": "https://*******.atlassian.net/rest/api/3/user?accountId=**********b97ab11a18e00c7",
"accountId": "***************8e00c7",
"accountType": "app",
"displayName": "Halp",
"active": true
},
{
"self": "https://*******.atlassian.net/rest/api/3/user?accountId=*******:0867a421-a9ee-4659-801a-bc0ee4a4487e",
"accountId": "*******:0867a421-a9ee-4659-801a-bc0ee4a4487e",
"accountType": "app",
"displayName": "Slack",
"active": true
},
{
"self": "https://*******.atlassian.net/rest/api/3/user?accountId=*******:214cdd6a-ff93-4d8b-838b-62dfcf1a2a71",
"accountId": "*******:214cdd6a-ff93-4d8b-838b-62dfcf1a2a71",
"accountType": "app",
"displayName": "Trello",
"active": true
},
{
"self": "https://*******.atlassian.net/rest/api/3/user?accountId=************c0efbe55103",
"accountId": "************0efbe55103",
"accountType": "app",
"displayName": "Opsgenie Integration",
"active": true
},
{
"self": "https://*******.atlassian.net/rest/api/3/user?accountId=*************29c6c47967",
"accountId": "******************c68529c6c47967",
"accountType": "app",
"displayName": "Statuspage for Jira",
"active": true
},
{
"self": "https://*******.atlassian.net/rest/api/3/user?accountId=60****************0682db95d",
"accountId": "6**************db95d",
"accountType": "atlassian",
"displayName": "yello",
"active": true
},

Prince Nyeche Community Leader Feb 24, 2021

Hi, you have to filter the result. Atlassian cloud has 4 different accountType namely:

  1. customer > for JSM customer users
  2. atlassian > for any Atlassian cloud user
  3. app > for any app on Atlassian cloud
  4. unknown > for any unknown users such as oAuth integration or there about.

Knowing the above, you should filter your output to get the desired result. For the information about billing, I'm not sure Atlassian has any public API for those but you can look into this Marketplace vendor API and see how that can help you.

Like divya likes this

while using the user api from my java code using url "https://*****.atlassian.net/rest/api/2/users/search?maxResults=100"

i get some users list but not complete list instead it suffixes the response with "...." like this, 

response: self":"https://****a213.atlassian.net/rest/api/2/user?accountId=-45c7-8e5c-ac6635decc67","accountId":"-45c7-8e5c-ac6635decc67","accountType":"atlassian","16x16":"https://secure...."

how to get complete list of users

Prince Nyeche Community Leader Feb 26, 2021

Hi @divya 

You need to use pagination in your code. You can use the startAt parameter to search record by record. Run a loop and only stop the loop when you reach an empty list like [] from the payload.

as per the resources.. the pagination will return some values such as total, isLast page etc ,but when I try I'm just getting the specified number of users and not the other stuff.

URL I used :  https://sitejira213.atlassian.net/rest/api/2/users?startAt=0&maxResults=6

My response : [{user},{user},{user},{user},{user},{user},{user}]  

expected response : { "startAt" : 0, "maxResults" : 10, "total": 200, "isLast": false, "values": [ { /* result 0 */ }, { /* result 1 */ }, { /* result 2 */ } ] }

Prince Nyeche Community Leader Mar 01, 2021

Hey @divya 

The API doesn't return the total number of user's available, you can get that from the record count.You can create a function that will produce the desired result you want. The API would just return the user's details only.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,193 views 8 28
Join discussion

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