2

I am using WSO2 IS v5.11.0.

I am trying to perform a PATCH request, where I am trying to remove a user from the group.

API: /Groups/{id}
Method: PATCH

Payload:

{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": [
    {
      "op": "remove",
      "value": {
        "members": [
          {
            "display": "USERSTORE1/newuser",
            "value": "5b957306-05ad-48ea-a2f5-230b99e989a8"
          }
        ]
      }
    }
  ]
}

I am getting the below error response

{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:Error"
    ],
    "scimType": "noTarget",
    "detail": "No path value specified for remove operation",
    "status": "400"
}

For the same API request payload, I could do the addition of user to group using "op": "add" but remove alone doesn't work!!

Can someone let me know the issue and how to do the removal of user from group?

Ref: https://is.docs.wso2.com/en/5.11.0/develop/scim2-rest-apis/#/Groups%20Endpoint/patchGroup

Community
  • 1
  • 1
nivedhav
  • 27
  • 5

1 Answers1

2

PATCH request to /Groups/{group-id} endpoint with one of the following payload will remove the user from the group.

  1. Specify the user need to be removed by user's uuid
{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:PatchOp"
    ],
    "Operations": [
        {
            "op": "remove",
            "path":"members[value eq 0565f472-28fe-4d93-83ad-096c66ed4a47]"
        }
    ]
}
  1. Specify the user need to be removed by user's username
{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:PatchOp"
    ],
    "Operations": [
        {
            "op": "remove",
            "path":"members[display eq anuradha]"
        }
    ]
}

You can find more details about scim "remove" operation in PATCH payload from here: https://datatracker.ietf.org/doc/html/rfc7644#section-3.5.2.2

Anuradha Karunarathna
  • 2,717
  • 2
  • 9
  • 17
  • For sake of archives, this should be marked as the correct answer. Despite numerous online resources having variants of the OP's attempted method to remove a user, the SCIM RFC begs to differ. The RFC provides a specific example which is the same as your answer here (https://www.rfc-editor.org/rfc/rfc7644#section-3.5.2.2) and a GitHub issue response at https://github.com/simpleidserver/SimpleIdServer/issues/164#issuecomment-871456758 explains more, describing the supported scenarios. – Andrew Hodgkinson Jan 26 '23 at 04:46