# How to aggregate WS Rest API data if response is an annonymous array?

**URL:** <https://developer.sailpoint.com/discuss/t/how-to-aggregate-ws-rest-api-data-if-response-is-an-annonymous-array/18975>\
**Category:** SHF Discussion and Questions\
**Tags:** webservice-connector, aggregation, sailpoint-identity-security\
**Created:** [October 10, 2023, 9:23pm UTC](https://developer.sailpoint.com/discuss/t/how-to-aggregate-ws-rest-api-data-if-response-is-an-annonymous-array/18975 "2023-10-10T21:23:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsosa](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jsosa/32/31578_2.png) [@jsosa](https://developer.sailpoint.com/discuss/u/jsosa)\
**Post date:** [October 10, 2023, 9:23pm UTC](https://developer.sailpoint.com/discuss/t/how-to-aggregate-ws-rest-api-data-if-response-is-an-annonymous-array/18975/1 "2023-10-10T21:23:58Z")

</div>

Hi all! I have a Web Service that returns a json like this:

```auto
  [
    {
      "id": "xxx",
      "fieldN": "....."
    },
    {
      "id": "yyy".
      "fieldN": "...."
    }
]

```

I am having trouble in getting aggregation work. I tried several root paths, por example  
-blank-  
$  
$.  
$.[\*]

But all returns 0 accounts. I have in the same tenant another WS, that has the structure

```auto
{
  "data":
    [
      {
        "id": "xxx",
        "fieldN": "....."
      },
      {
        "id": "yyy".
        "fieldN": "...."
      }
    ]
}

```

and Root Path $.data works fine. I think problem comes whith other WS because array is annonymous. Have anybody deal with some ws like this?

---

<div class="post-metadata">

**Author:** ![KevinHarrington](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/kevinharrington/32/6776_2.png) [@KevinHarrington](https://developer.sailpoint.com/discuss/u/KevinHarrington)\
**Post date:** [October 10, 2023, 9:39pm UTC](https://developer.sailpoint.com/discuss/t/how-to-aggregate-ws-rest-api-data-if-response-is-an-annonymous-array/18975/2 "2023-10-10T21:39:19Z")

</div>

Here’s an example where I’m only pulling in a single attribute “groupId”. In this case it’s the second step of an account aggregation process in which we are only pulling in a list of group Id’s associated with each user:

```auto
Map newMap = new HashMap();
List newList1 = new ArrayList();
for(Map m : processedResponseObject) {
	if(m.get("groupId") != null) { newList1.add(m.get("groupId")); }
}
newMap.put("groupId", newList1);
processedResponseObject = new ArrayList();
processedResponseObject.add(newMap);
Map returnMap = new HashMap();
returnMap.put("data", processedResponseObject);
return returnMap;

```

---

<div class="post-metadata">

**Author:** ![jsosa](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jsosa/32/31578_2.png) [@jsosa](https://developer.sailpoint.com/discuss/u/jsosa)\
**Post date:** [October 11, 2023, 6:05pm UTC](https://developer.sailpoint.com/discuss/t/how-to-aggregate-ws-rest-api-data-if-response-is-an-annonymous-array/18975/3 "2023-10-11T18:05:18Z")

</div>

Hi, after some headaches of trying/error we find solution.

On root path, we left only $[\*]

![image](https://global.discourse-cdn.com/sailpoint/original/2X/5/5512bd85bd7c8a77c980943af83bc37b9f375bb8.png)

Then, on Response Mapping configuration, we left attribute path columns with field names only. We are getting accounts now.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [December 10, 2023, 6:05pm UTC](https://developer.sailpoint.com/discuss/t/how-to-aggregate-ws-rest-api-data-if-response-is-an-annonymous-array/18975/4 "2023-12-10T18:05:23Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
