Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

500 error when running /admin/v1/orgs/{orgId}/users

Tony Paterson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 29, 2020

If I run the REST api call:

https://api.atlassian.com/admin/v1/orgs/{orgid}/users?cursor=0

It returns a status of 500

JSON body is:

 

{    "errors": [        {            "id""7b359bcc-e2e1-4ed1-bd24-d59a4e64a3c8",            "status""500",            "code""ADMIN-500-1",            "title""Internal error",            "detail""We encountered an internal error."        }    ]}

 

If I remove the "cursor" parameter it works. But it used to work until about 2 days ago and I need the cursor because the results are paged

2 answers

1 vote
Tyler B [Atlassian]
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 10, 2021

Hey Tony,

I know this is coming late for you, but your post shows up in various searches for this issue so I thought I'd leave a comment here for future people.

When you send a request to that endpoint, you will get a JSON object that is structured broadly like this:

{
   "data":[...],
   "links":{
      "self":"https://api.atlassian.com/admin/v1/orgs/{orgid}/users",      "next":"https://api.atlassian.com/admin/v1/orgs/{orgId}/users?cursor={a long string of random characters}"   }
}

You're interested in following that "links.next" link. The cursor is not a number that you can increment through predictably.

0 votes
Tony Paterson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 10, 2021

Yes I had found that later on.

In my Python code I get the json object as currUserDetailPage['json'] and then apply the below code:

#
# Get the next cursor value
#
if 'next' in currUserDetailPage['json']['links']:
   nextCursorStr = currUserDetailPage['json']['links']['next']
   nextCursorMatch = re.search('cursor=(.*)', nextCursorStr )
   if nextCursorMatch:
      cursor = nextCursorMatch.group(0)[7:-1]
      logger.debug('Next cursor value = ' + cursor, extra={'vstsLevel':coreconf.vsPurple})
      sys.stdout.flush()
   else:
      logger.error('Next link found but no cursor value specified', extra={'vstsLevel':coreconf.vsRed})
      sys.stdout.flush()
      quit(1)
else:
   allDataCollected = True

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events