Web Services Pagination with Reverse Entitlements

Hey guys! So recently had an issue aggregating entitlements via the “reverse entitlement” method suggested in my original post - After Operation Rule Entitlement Issue.

After I got this working I ran into issues paginating through the child group aggregation request. The request takes the role name from the parent request, passes it into the child and collects membership data like so /v1/users?in_roles=$response.name$&take=100

The response includes user objects like so

{
    "data": [
        {
            "id": 1000346685,
            "external_id": null,
            "email": "[email protected]",
            "name": "Test Support",
            "first_name": "Test",
            "last_name": "Support",
            "avatar_url": "url.com",
            "job_title": null,
            "timezone": "America/Los_Angeles",
            "locale": "en-US",
            "hire_date": null,
            "date_of_birth": null,
            "mobile_phone": null,
            "direct_dial": null
        }],
      "status": "success",
      "meta": {
            "pagination": {
                  "skip": 0,
                  "take": 100,
                  "total_records": 20,
                  "next_page": "nextpage.com"
        }
    }
}

Where the user data is contained in the {data} array. The request collects the emails under a multivalued members entitlement attribute which is assigned to the accounts in an after operations rule.

Some roles have no users which returns as so:

{
    "data": [],
    "status": "success",
    "meta": {}
}

My paging rule:

TERMINATE_IF ($NO_RECORDS$ == TRUE) || ($RECORDS_COUNT$ == $response.meta.pagination.total_records$)
$skip$ = $skip$ + 100
$endpoint.fullUrl$ = $application.baseUrl$ + $endpoint.relativeUrl$ + "&skip=" + $skip$

The is supposed to handle roles with no users in the first termination, and roles with users with the second. But when I run it, I get this error:

Exception during aggregation of Object Type group on Application Workvivo [source]. Reason: java.lang.RuntimeException: An error occurred while aggregating Application Workvivo [source] An internal error occurred handling stream response from the server.

The paginated request expects to get the entitlement name from the parent request, the emails in the second. I was able to run this pre-pagination without issues, even on “userless” roles. Not sure what is causing the error. Thanks for your help!

1 Like

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