Updating Custom User Schema Attributes Using PATCH

Replace attributes in the custom schema using the PATCH method.

Using the Replace Operation

In this example, the PATCH "replace" operation is used, and the attribute name is picked from the request payload for patching. If the name specified already exists, it replaces it automatically. If it doesn't exist, an error message appears.

Example PATCH Request

Patch /Schemas/urn:item:params:scam:schemas:idcs:extension:custom:User
{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:PatchOp"
    ],
    "Operations": [
        {
            "op": "replace",
            "path": "attributes",
            "value": [
                {
                    "name": "nickName",
                    "idcsDisplayName": "nickName",
                    "description": "Nickname",
                    "required": false,
                    "type": "string",
                    "idcsMinLength": 3,
                    "idcsMaxLength": 25,
                    "idcsAuditable": false,
                    "caseExact": true,
                    "returned": "default",
                    "multiValued": false
                }
            ]
        }
    ]
}

Example JSON Response

{
    "name": "CustomUser",
    "description": "Custom User",
    "id": "urn:ietf:params:scim:schemas:idcs:extension:custom:User",
    "idcsResourceTypes": [
        "User"
    ],
    "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0:Schema"
    ],
    "attributes": [
        {
            "idcsTargetAttributeName": "U_VC_40_IFLEX_1",
            "idcsAuditable": false,
            "idcsValuePersisted": true,
            "description": "Nickname",
            "idcsSearchable": true,
            "idcsMaxLength": 25,
            "uniqueness": "none",
            "name": "nickName",
            "idcsDisplayName": "nickName",
            "required": false,
            "type": "string",
            "idcsMinLength": 3,
            "caseExact": true,
            "returned": "default",
            "multiValued": false
        } 
    ],
    "meta": {
        "lastModified": "2018-08-15T19:55:17.467Z",
        "resourceType": "TenantSchema",
        "created": "2018-08-15T05:02:13.788Z",
        "location": "https://<tenant-base-url>/admin/v1/TenantSchemas/urn:ietf:params:scim:schemas:idcs:extension:custom:User"
    },
    "idcsLastModifiedBy": {
        "type": "App",
        "display": "admin",
        "$ref": "https://<tenant-base-url>/admin/v1/Apps"
    },
    "idcsCreatedBy": {
        "value": "158d625222f442ef8fcc817593701dd9",
        "type": "App",
        "display": "idcssm",
        "$ref": "https://<tenant-base-url>/admin/v1/Apps/158d625222f442ef8fcc817593701dd9"
    }
}

Using the Replace Operation With Filters

  • In this example, the PATCH "replace" operation is used with filters to update to "true" all attributes that have the "required" property with the "returned" attribute set to "always":
    PATCH /Schemas/urn:item:params:scam:schemas:ides:extension:custom:User
    {
        "schemas": [
            "urn:ietf:params:scim:api:messages:2.0:PatchOp"
        ],
        "Operations": [{
                "op": "replace",
                "path": "attributes[name eq \"workName\"].idcsDisplayName",
                "value": "workplace Name"
            }]
    }
  • In this example, the PATCH "replace" operation is used with filters to update to "false" all attributes with the "auditable" property set to "true".
    PATCH /Schemas/urn:item:params:scam:schemas:ides:extension:custom:User
    {
        "schemas": [
            "urn:ietf:params:scim:api:messages:2.0:PatchOp"
        ],
        "Operations": [{
                "op": "replace",
                "path": "attributes[returned eq \"default\"].required",
                "value": true
            }]
    }

Example JSON Response

{
    "name": "CustomUser",
    "description": "Custom User",
    "id": "urn:ietf:params:scim:schemas:idcs:extension:custom:User",
    "idcsResourceTypes": [
        "User"
    ],
    "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0:Schema"
    ],
    "attributes": [
        {
            "idcsTargetAttributeName": "I_VC_40_IFLEX_1",
            "idcsMinLength": 1,
            "idcsValuePersisted": true,
            "idcsMaxLength": 20,
            "type": "string",
            "idcsSearchable": true,
            "idcsDisplayName": "nationality",
            "name": "nationality",
            "idcsAuditable": true,
            "multiValued": false,
            "description": "nationality",
            "returned": "default",
            "required": false,
            "uniqueness": "none",
            "caseExact": true
        },
        { 
            "idcsTargetAttributeName": "U_VC_4K_IFLEX_1",
            "idcsDisplayName": "workplace Name",
            "description": "workName",
            "idcsCsvAttributeName": "CSV1",
            "type": "string",
            "idcsMaxLength": 4000,
            "idcsAuditable": true,
            "required": false,
            "returned": "default",
            "idcsMinLength": 1,
            "name": "workName",
            "idcsSearchable": false,
            "multiValued": false,
            "caseExact": true,
            "uniqueness": "none",
            "idcsValuePersisted": true
        }
    ],
    "meta": {
        "lastModified": "2018-08-15T20:15:21.969Z",
        "resourceType": "TenantSchema",
        "created": "2018-08-15T05:02:13.788Z",
        "location": "https://<tenant-base-url>/admin/v1/TenantSchemas/urn:ietf:params:scim:schemas:idcs:extension:custom:User"
    },
    "idcsLastModifiedBy": {
        "type": "App",
        "display": "admin",
        "$ref": "https://<tenant-base-url>/admin/v1/Apps"
    },
    "idcsCreatedBy": {
        "value": "158d625222f442ef8fcc817593701dd9",
        "type": "App",
        "display": "idcssm",
        "$ref": "https://<tenant-base-url>/admin/v1/Apps/158d625222f442ef8fcc817593701dd9"
    }
}

Using the Replace Operation to Update a Multi-Valued String Attribute

You can replace multi-valued string attributes in your custom schema using the PATCH method. In this example, the PATCH "replace" operation is used, and the attribute name is picked from the request payload for patching. If the name specified already exists, it replaces it automatically. If it doesn't exist, an error message appears.

Example PATCH Request

Patch admin/v1/Schemas/urn:ietf:params:scim:schemas:idcs:extension:custom:User
{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:PatchOp"
    ],
    "Operations": [{
            "op": "replace",
            "path": "attributes",
            "value": [
                {
                    "name": "hobbies",
                    "idcsDisplayName": "hobbies",
                    "description": "hobbies",
                    "required": true,
                    "type": "string",
                    "idcsMinLength": 1,
                    "idcsMaxLength": 20,
                    "idcsAuditable": true,
                    "returned": "default",
                    "idcsValuePersisted": true,
                    "idcsSearchable": true,
                    "multiValued": true
                }
            ] 
        }
    ]
}