I have two Account Aggregation operations and I’m trying to have the second populate a multi-valued entitlements attribute on my account schema. It doesn’t seem to be working. Here’s how it’s set up.
Account Schema
Entitlement Schema
Operation 1: Get Users
Here is a sample JSON output from this endpoint. It contains multiple user records within the $.data array
{
"data": [{
"last_login": "2022-02-24 22:22:45.606979",
"status": "A",
"user_id": 221,
"full_name": "John Smith",
"user_name": "John Smith",
"flags": "E",
"guarantee_license": 0,
"update_ts": "2022-02-24 22:22:45.606979+00",
"create_user": 221,
"update_user": 1,
"create_ts": "2021-07-03 14:44:09.592547+00",
"email_address": "[email protected]",
"payment_threshold": "0.00"
},
{
"status": "A",
"user_id": 199,
"last_login": "2022-02-24 19:17:19.521672",
"full_name": "Lisa Smith",
"flags": "E",
"user_name": "Lisa Smith",
"update_ts": "2022-02-24 19:17:19.521672+00",
"create_user": 199,
"guarantee_license": 1,
"payment_threshold": "0.00",
"email_address": "[email protected]",
"update_user": 1,
"create_ts": "2020-10-06 19:59:24.906656+00"
}
],
"header": {
"data_rows": 2,
"query_rows": 2,
"primary_key": [
"user_id"
],
"next_page": "https://preview-landview.peloton.com/api/v1/sys_user?%24page=2",
,
"sort_order": [
"me.update_ts",
"me.user_id"
]
}
}
Here is how it’s configured
Operation 2: Aggregate User Entitlements
It’s hard to see but the context URL is
/api/v1/user_group?user_id=$response.user_id$
Here is an example JSON response you get when you add the query parameter
?user_id=199
{
"header": {
"data_rows": 4,
"relationships": [
"SysGroup",
"SysUser",
"SysUser",
"SysGroup",
"SysRole",
"SysGroupPermission"
],
"primary_key": [
"rel_id"
],
"query_rows": 4,
"sort_order": [
"me.update_ts",
"me.rel_id"
]
},
"data": [
{
"create_user": 227,
"role_id": null,
"update_ts": "2021-07-12 13:46:02.443743+00",
"group_id": 123,
"rel_id": 102,
"create_ts": "2021-07-12 13:46:02.443743+00",
"user_id": 199,
"update_user": 227
},
{
"user_id": 199,
"create_ts": "2021-07-12 13:46:02.443743+00",
"update_user": 227,
"create_user": 227,
"group_id": 125,
"update_ts": "2021-07-12 13:46:02.443743+00",
"role_id": null,
"rel_id": 101
},
{
"create_user": 227,
"role_id": null,
"update_ts": "2021-07-12 13:46:02.443743+00",
"group_id": 120,
"rel_id": 100,
"create_ts": "2021-07-12 13:46:02.443743+00",
"user_id": 199,
"update_user": 227
},
{
"rel_id": 99,
"group_id": 128,
"update_ts": "2021-07-12 13:46:02.443743+00",
"role_id": null,
"create_user": 227,
"update_user": 227,
"create_ts": "2021-07-12 13:46:02.443743+00",
"user_id": 199
}
]
}
This user_group table is essentially a join table between the sys_user and sys_group tables. sys_group is where my entitlements are pulled from.
In a post in this thread, @colin_mckibben suggests using this jsonpath tool with the Goessner output type selected.
When I use the path
$.data.[*].group_id
The output appears correct
[
123,
125,
120,
128
]
Here’s a screenshot of me checking that
This all appears that it should work, but just isn’t. Any suggestions?