Hi,
One of our customers Censia has integrated with us and we're trying to fetch all users in their Jira.
We use this endpoint https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-users-search-get to fetch the users, but it is returning empty list `[]`.
I have checked that the person trying to connect admin@censia.com is an admin in jira.
Can you help me find out why that might be happening?
Here's the curl request:
```curl --location --request GET 'censia.atlassian.net/rest/api/3/user/search?username=&maxResults=1000' \--header 'Authorization: <basic auth creds>'```
Hello @Nitin Patel ,
If I understand correctly you are trying to get all the users from your instance using REST API but this is returning empty array.
If this is correct, since the GET /rest/api/3/user/search method can also be called by anonymous users, there are chances that either the authentication failed:
This operation can be accessed anonymously.
Or that the account used to authenticate the call does not have browse users permission:
Permissions required: Browse users and groups global permission. Anonymous calls or calls by users without the required permission return empty search results.
However, I can also see a number of other things that does not seem correct in the provided Curl example:
Therefore, can you kindly run the following curl command against your instance and paste the results in your reply removing the sensitive data like shown below?
curl -u <EMAIL-ADDRESS>:<API-TOKEN> -D- -X GET "https://<NAME>.atlassian.net/rest/api/3/user/search?query=&maxResults=1000" HTTP/2 200 server: AtlassianProxy/1.15.8.1[...]date: Fri, 10 Apr 2020 12:40:25 GMTatl-traceid: 4e5300a61b1fd8abx-arequestid: 75d19ba1-eef9-490a-bfbc-6271f33c2b4f[...] [{"self":"https://<NAME>.atlassian.net/rest/api/3/user?accountId=5bacXXXXXXXXXXXXXXXXXXbd","accountId":"5bacXXXXXXXXXXXXXXXXXXbd","accountType":"atlassian","emailAddress":"aXXXXXXXXX@atlassian.com","avatarUrls":{"48x48":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5bacXXXXXXXXXXXXXXXXXXbd/dac690af-6307-4655-893c-691c5900a5fb/128?size=48&s=48","24x24":"https:.....[...]
Finally, please notice that the endpoint you are using might not return all the results as mentioned in the documentation:
This operation takes the users in the range defined by startAt and maxResults, up to the thousandth user, and then returns only the users from that range that match the search string and property. This means the operation usually returns fewer users than specified in maxResults. To get all the users who match the search string and property, use Get all users and filter the records in your code.
startAt
maxResults
Cheers,Dario
> Permissions required: Browse users and groups global permission. Anonymous calls or calls by users without the required permission return empty search results.
How can I check via API that the admin who connected has this permission?
By the way, I tried your other suggestions and it still didn't work.
Hi @Nitin Patel ,
Please notice that in my reply I asked to run the request using curl and to paste the output (anonymized) in here:
Therefore, can you kindly run the following curl command against your instance and paste the results in your reply removing the sensitive data like shown below? curl -u <EMAIL-ADDRESS>:<API-TOKEN> -D- -X GET "https://<NAME>.atlassian.net/rest/api/3/user/search?query=&maxResults=1000" HTTP/2 200 server: AtlassianProxy/1.15.8.1[...]date: Fri, 10 Apr 2020 12:40:25 GMTatl-traceid: 4e5300a61b1fd8abx-arequestid: 75d19ba1-eef9-490a-bfbc-6271f33c2b4f[...] [{"self":"https://<NAME>.atlassian.net/rest/api/3/user?accountId=5bacXXXXXXXXXXXXXXXXXXbd","accountId":"5bacXXXXXXXXXXXXXXXXXXbd","accountType":"atlassian","emailAddress":"aXXXXXXXXX@atlassian.com","avatarUrls":{"48x48":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5bacXXXXXXXXXXXXXXXXXXbd/dac690af-6307-4655-893c-691c5900a5fb/128?size=48&s=48","24x24":"https:.....[...]
Also, once done, please let me know date, time and timezone you have run the request so I can go check the logs.
Hey, I have the same issue, an empty group list when targetting https://<base URL>/rest/api/2/myself
Here is the returned result:
{"self":"https://<base URL>/rest/api/2/user?username=<my username>", […], "locale":"en_US","groups":{"size":14,"items":[]},"applicationRoles":{"size":2,"items":[]},"expand":"groups,applicationRoles"}
No where is the list of groups/application roles.
I have the browse users and groups permission.
It looks like you're new here. Sign in or register to get started.