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
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
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.
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.