Is it possible to provide separate Add Entitlement(Patch) API and Remove Entitlement(Patch) API?

Options

We are looking to have 2 separate Patch Endpoints for:

1) Add Role (Entitlement) and 

2) Remove Role (Entitlement)

As the current patch is replacing the existing roles, while adding new roles.

For example, via API, when a user has 2 roles such as "Designer" and "Administrator" and we try to update the role for that user to remove "Designer" and add a new role of "Data Consumer", rather than just add the new role, it essentially replaces both Designer and Administrator role with new roles of Administrator and Data Consumer.

Tagged:

Best Answer

  • Josh Boxer
    Josh Boxer Administrator
    Answer ✓
    Options

    Hi, that is the way a PATCH call works it just allows you to not submit any other fields that are not being amended.

    The way to solve this is to firstly GET the user details for id=23, amend as required adding further roles in this case, then submit your PATCH on the record.

Answers

  • Josh Boxer
    Josh Boxer Administrator
    Options

    Your User has the Roles "Designer" and "Administrator". You want to update the User to have the Roles "Consumer" and "Administrator".

    Unclear to me why this was not working for you if you can explain further or just try again PATCHing the user with the role(s) they should be updated to have.

  • ifr89
    ifr89 Member
    Options

    Second attempt, we have Administrator and Designer for id=23.

    We try to add new roles that are not present on the user, Data Consumer and Provisioning.

    The result is that the existing roles Administrator and Designer are removed and replaced with the two new roles to added.

    Thus, instead of having 4 roles as intended, the user is still left with 2 roles (the new roles).


    Screenshots attached.