API to Add New Entitlements to Existing Access Profiles

The existing V3 API for patching/updating existing Access Profile accepts the entitlements argument but it replaces the existing entitlements instead of adding it.

For a single use, this API works fine but we are looking to add entitlements to existing set of entitlements in existing access profile in bulk. To achieve this we always have to do a GET call then append the entitlements map before calling the PATCH.

Having functionality in PATCH API for Access Profiles or a new API that could just append the new entitlements to the existing entitlements would be good to have.

You can add a single entitlement to Access Profile by specifying the body of the request as below:

[
  {
    "op": "add",
    "path": "/entitlements/N",
    "value": {
            "id": "entitlementId",
            "type": "ENTITLEMENT",
            "name": "Name of Entitlement"
        }
  }
]

where N is the index of new entitlement, which will be same as the number of current entitlements as this index starts with 0.

However, you can add only one entitlement using this and, if you need to add multiple, then will have to iterate through the entitlements and call the PATCH operation inside each iteration

Thanks, Nithesh. I wasn’t aware of this path.

To derive the value of N though, we still have to make a GET call.

You are right… you still have to make a GET call to get the count of current entitlements.

Unfortunately, there is no append option to add a new item to the entitlements that is an array inside Access profile object. It surely is a nice to have feature :blush:

1 Like