The steps I followed were as follows:
1. I defined the Jira Rest API scope to view user profiles (read:jira-user)
2. I obtained an authorization code using the authorization URL
3. Exchanged the authorization code for a bearer token using the link: https://auth.atlassian.com/oauth/token
4. Used the bearer token to search for a user using the Query:
curl -X GET \
https://<site>.atlassian.net/rest/api/3/user/search?query=%'\
-H 'Accept: application/json' \
-H 'Authorization: Bearer <Bearer Token>' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Host: <site>.atlassian.net' \
-H 'Postman-Token: 8cf2cf71-15b0-4e15-a7c1-65bf0be730ed,b63f2a6f-85fa-455a-b5f2-66088483c422' \
-H 'User-Agent: PostmanRuntime/7.15.0' \
-H 'accept-encoding: gzip, deflate' \
-H 'cache-control: no-cache' \
-H 'content-length: 23' \
-H 'cookie: atlassian.xsrf.token=BET3-9NB2-SL21-3ZD3_946fdfc8ec4999d356397800e32416b41fc70b82_lout' \
-b atlassian.xsrf.token=BET3-9NB2-SL21-3ZD3_946fdfc8ec4999d356397800e32416b41fc70b82_lout \
For that I get the response:
[]
But I should be getting a list of 5 users instead.
Am I doing something wrong here?
Hello!
This might be an incredible over-simplification of your question, but I've tried multiple REST API user search queries on my Jira Cloud instance and the only response that returns all defined users is to leave the query blank:
https://<site>.atlassian.net/rest/api/3/user/search?query=
A caveat is that this introduces an additional problem, which is that all users returned via this query include users not visible via the UI, such as invisible users added via plugins. However, these users are limited in scope and you can usually programatically eliminate them depending on what you're trying to get from the search.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.