Atlassian API - Extracting data from Collections...within an Array

Hi

I’m working with the Atlassian API, and following this tutorial to be able to add a user to a group (Add user to group)

The first step is to search all the users in the Atlassian instance, to get the users accountId

I’ve got a Basic Auth request, which interacts with the Atlassian API OK, but i’m having trouble with the data it returns, and being able to search for a specific user.

The Basic Auth Request looks like this

And then in the output it returns data like this
image

And finally an example of the data in a Collection is like this
image

Example of the data is below

"data": [
            {
                "self": "https://test123.atlassian.net/rest/api/3/user?accountId=783720:62a0e7df-322d-4cbb-b15d-2ff90b17a242",
                "accountId": "783720:62a0e7df-322d-4cbb-b15d-2ff90b17a242",
                "accountType": "atlassian",
                "emailAddress": "john.smith@test123.com",
                "avatarUrls": {
                    "48x48": "https://secure.gravatar.com/avatar/bd8d14bab8df72fb471986aa180c568e?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FRY-1.png",
                    "24x24": "https://secure.gravatar.com/avatar/bd8d14bab8df72fb471986aa180c568e?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FRY-1.png",
                    "16x16": "https://secure.gravatar.com/avatar/bd8d14bab8df72fb471986aa180c568e?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FRY-1.png",
                    "32x32": "https://secure.gravatar.com/avatar/bd8d14bab8df72fb471986aa180c568e?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FRY-1.png"
                },
                "displayName": "John Smith",
                "active": true,
                "locale": "en_US"
            },
            {
                "self": "https://test123.atlassian.net/rest/api/3/user?accountId=a57158:f58131cb-b67d-43c7-b30d-4b58d30bd077",
                "accountId": "a57158:f58131cb-b67d-43c7-b30d-4b58d30bd077",
                "accountType": "atlassian",
                "emailAddress": "frank.barns@test123.com",
                "avatarUrls": {
                    "48x48": "https://secure.gravatar.com/avatar/600529a7c8cfef89daa848e6db28ed2d?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FAJ-0.png",
                    "24x24": "https://secure.gravatar.com/avatar/600529a7c8cfef89daa848e6db28ed2d?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FAJ-0.png",
                    "16x16": "https://secure.gravatar.com/avatar/600529a7c8cfef89daa848e6db28ed2d?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FAJ-0.png",
                    "32x32": "https://secure.gravatar.com/avatar/600529a7c8cfef89daa848e6db28ed2d?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FAJ-0.png"
                },
                "displayName": "Frank Barns",
                "active": true,
                "locale": "en_US"
            }

I’ve using an iterator, but it only returns data from the first bundle.

I just need to be able to search by the users emailAddress and return the accountId.

Thanks

Hi @johnanderson ,

Welcome to Make Community!

We have a couple of solutions for you, please check the below images and notes.


We are providing the function below so that you can copy and paste this into your scenario and change the mappings.

{{get(map(1.data; "accountId"; "emailAddress"; "john.smith@test123.com"); 1)}}

Second Method:-

Use an iterator and map the whole array to it as shown below.


After the iterator add a filter for matching the email.

Once the filter is added you can simply map the account id directly.

For a better understanding please watch the loom below.

Loom : https://www.loom.com/share/0dd926370c374c128e37e2a95ca6b9db?sid=c5cff3af-6223-4003-a2d4-b4d494e6301e

Regards,
Msquare Automation - Gold Partner of Make

Book a Free Consultation
| Connect Live

Explore our YouTube Channel
for valuable insights and updates!

3 Likes

Yup, that works great. Not sure why my initial Iterator wasn’t working properly.
Thanks!

1 Like

Glad to hear that the issue is resolved…

Regards,
Msquare Automation - Gold Partner of Make

Book a Free Consultation | Connect Live

Explore our YouTube Channel for valuable insights and updates!