API - "Get user email bulk" endpoint returns empty when used with multiple IDs

wei April 16, 2021

When using the "Get user email bulk" (/rest/api/3/user/email/bulk) with a single accountId parameter, I am able to get the email address associated with the id, e.g

/rest/api/3/user/email/bulk?accountId={accountId}

but I have tried the following and both result in a 200 response that has an empty array:

/rest/api/3/user/email/bulk?accountId={accountId1},{accountId2}

/rest/api/3/user/email/bulk?accountId={accountId1}&&accountId={accountId2}

What is the correct syntax for using multiple ids?

1 answer

0 votes
Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 17, 2021

Hi @wei 

I would like to ask, did you use an Array<string> to construct the request that you're trying to get? I would expect an array of strings to look like below.

/rest/api/3/user/email/bulk?accountId=[{accountId}, {accountId}]
wei April 19, 2021

Hi @Prince Nyeche

I've tried that and it too returns an empty array as the result.

Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 19, 2021

Just want to ask, did you register with Atlassian to get access to this API as it is a private API after all?

wei April 19, 2021

Yep, I had requested access to email addresses from Atlassian and received approval for it a while back. I figure it might be an issue with syntax for the URI, since with "Get user email" (/rest/api/3/user/email?accountId={accountId1}) I am able to get the correct results for a single accountId.

Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 20, 2021

@wei Yeah, it should probably be the syntax or do they want you to feed the data from a list into the endpoint

lists = [accountId1, accountId2, accountId3]
for x in lists:
run = /rest/api/3/user/email?accountId=x

I'm not sure if this what's expected, but if a single entry works, then doing like above should. 

Suggest an answer

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

Atlassian Community Events