Deleting a member of a multi valued user attribute using scim PATCH

562 views Asked by At

I have a user store where user have multi valued attributes like email. So the user will have attribute called emails which may have 0 to many emails on it.

"emails" : ["[email protected]", "[email protected]",........]

Let's say I need to delete "[email protected]" email address from the users email list. Can I do it using user PATCH? If so what should I send with request?

1

There are 1 answers

0
cody On

You can do it using PATCH. Except when removing a value from a multi-valued attribute, you have to include an "operation" sub-attribute, which in this case should have a value of "delete". It's discussed in section 3.3.2 in the spec: http://www.simplecloud.info/specs/draft-scim-api-01.html

Here is an example, from that link:

PATCH /Groups/acbf3ae7-8463-4692-b4fd-9b4da3f908ce
Host: example.com
Accept: application/json
Content-Type: application/json
Authorization: Bearer h480djs93hd8
If-Match: W/"a330bc54f0671c9"

{
  "schemas": ["urn:scim:schemas:core:1.0"],
  "members": [
    {
      "display": "Babs Jensen",
      "value": "2819c223-7f76-453a-919d-413861904646"
      "operation": "delete"
    }
  ]
}