What is the function-id path variable in User Functionality management REST API WSO2 Identity server 6.1.0

66 Views Asked by At

I'm trying to lock and unlock a user using User Functionality management API in WSO2 Identity server 6.1.0 referring WSO2 documentation https://is.docs.wso2.com/en/6.1.0/apis/user-functionality-mgt-rest-api/#/user%20functionality%20management/changeStatus. According to documentation the URL is like {{baseUrl}}/:user-id/user-functionality/:function-id. But I can't find a value for function-id.

I tried LOCK,lock, UNLOCK, unlock, 0, 1, 2 values as function id but they were failed. Can anyone help me to find values for function-id or alternative for this API

1

There are 1 best solutions below

3
Anuradha Karunarathna On

In order to lock a user account by an admin user, try the following API

curl --location --request PATCH 'https://localhost:9443/scim2/Users/<user-id>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--data '{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:PatchOp"
    ],
    "Operations": [
        {
            "op": "replace",
            "value": {
                "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
                    "accountLocked": "true"
                }
            }
        }
    ]
}'

For unlock use "accountLocked": "false".

Inorder to find the user id you can use GET https://localhost:9443/scim2/Users API with filtering . Refer: https://is.docs.wso2.com/en/latest/apis/scim2-rest-apis/#/Users%20Endpoint/getUser