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
Next: Root
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
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello,
Is there a way of getting a list of customers in a project through API? I can get a list of users in an organization but the users who are not part of any organization I am unable to see how I can get a list of these users.
Thanks!
Hello Harry,
Thanks for reaching out to Community!
It's possible to get all customers of a service desk project using API. For that, please use the endpoint below:
GET /rest/servicedeskapi/servicedesk/{serviceDeskId}/customer
This method returns a list of the customers on a service desk.
Please, give it a try and let us know how it goes.
Regards,
Angélica
This call will only retrieve 50 results at a time. :-\ (regardless of the limit parameter chosen)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Charles Johnson You can get all the results using pagination:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I've tried that. it always defaults to '50', regardless of the value provided in the limit parameter. (using Cloud)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Charles Johnson ,
The page I am referring to says that in some cases only a limited subset of results is returned and, in those cases, you can use pagination to get all the results.
In short:
You get the first 50 results by calling:
Then to get the next 50 results you call:
And so on. Please refer to the documentation (pagination section) for more details:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My experience thus far when using the 'limit' parameter:
https://XXX.atlassian.net/rest/servicedeskapi/servicedesk/{serviceDeskId}/customer?limit=100
it will always revert back to '50' .. and the response's "isLastPage" value is always "true"
{ "size": 50, "start": 0, "limit": 50, "isLastPage": true,....
(i know i have more than 50 customers :-) )
I've tried adding "&size=100" as a parameter (as the pagination page suggests) but it only ever & always reverts to '50' as the maximum number of record returns.
Even if i had to loop through pages (using & incrementing the 'start' parameter as in your example...which would be very inconvenient) the response always shows "isLastPage: true" .. so i have no programable way to determine if i've received ALL the pages or not.
If you know of the exact incantation to pull back all the records (no pagination required) that would solve my needs for using this API. Otherwise, i keep bumping into "50" with no clear stopping point ¯\_(ツ)_/¯
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The maximum results it will return at one time is 50 and I don't believe there is a way around it. You'll just have to manually adjust the 'start' query and go through the list until you get to the end.
So you'd have to start at:
0-49
https://XXXXXX.atlassian.net/rest/servicedeskapi/servicedesk/1/customer
50-99
https://XXXXXX.atlassian.net/rest/servicedeskapi/servicedesk/1/customer?start=50
100-49
https://XXXXXX.atlassian.net/rest/servicedeskapi/servicedesk/1/customer?start=100
Hope that helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for explaining this in more details @Harry Bob .
Also, I can confirm there is no way around the hard limit of 50 for this endpoint and therefore the only way to get all the results is to use pagination (the 'start' parameter to cycle through all the results).
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Rats. The pagination requirement complicates my process.
What about the "isLastPage" value always being "true"?
Is that by design, or should it say "false" if start at '0' and have 400 customers that I have to page through incrementally? (secret question: how do i know how many times i have to page through another set of '50' before i can stop the process loop?)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Charles Johnson ,
After a bit of research I have found the below bug ticket opened some time ago in order to address the pagination issues with this endpoint:
Since the description was incomplete, I have added below details to it:
Other issues with this endpoint:
- Even if not specified on the documentation, this is an experimental endpoint. Therefore, you must add the X-ExperimentalApi: opt-in header in your requests or it won't work.
- The isLastPage attribute is returning as true on each request.
- The start and limit attributes do not reflect the values passed as url parameters.
For example, callling: https://XXXX.atlassian.net/rest/servicedeskapi/servicedesk/12/customer?start=10&limit=10 returns:{ "size": 10, "start": 0, "limit": 50, "isLastPage": true, ...
I have also forwarded this information to the developer assigned to this ticket.
Please vote for the above bug ticket and set yourself as a watcher so that you will be notified in case of any update/progress. The bug will be addressed according to the Atlassian Cloud bug fixing policy.
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is a python script to query for a customer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.