Hello, I am using the Atlassian User Management REST API to fetch all active users in my directory, but it is only returning 50 users.
I am trying to retrieve all users in out Atlassian Cloud org using the Admin API, here is my core logic. I removed tokens and company specific info.
def fetch_atlassian_users():
users = []
next_cursor = None
page_number = 1
while True:
params = {
"limit": 100,
}
if next_cursor:
params["cursor"] = next_cursor
response = requests.get(url, headers=headers, params=params, timeout=10)
response.raise_for_status()
data = response.json()
logging.info("Page %d: %d users fetched", page_number, len(data.get('data', [])))
for user in data.get("data", []):
if user.get("account_status") == "active":
users.append({
"account_id": user.get("account_id"),
"email": user.get("email"),
"name": user.get("name"),
"account_status": user.get("account_status"),
})
next_cursor = data.get("meta", {}).get("next_cursor")
if not next_cursor:
break
page_number += 1
logging.info("Fetched %d users from Atlassian", len(users))
return users