Update user information using REST

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Security definition > Work Portal Security > Synchronizing users > Synchronizing users using SCIM's REST methods > Getting started with user sync using REST >

Update user information using REST

To update A user's information using the Bizagi SCIM you must use the service described in this article. The following example uses POSTMAN as the client, but you can invoke this service from any client compatible with RESTful services with OAUth 2.0 authentication.

 

Before continue, review the Getting started with the synchronization procedure section.

 

Resource URL

[Project_URL]/scim/v2/Users/{username}

 

HTTP Method

PATCH

 

Authorization

OAuth 2.0

 

Input

The username or ID ( guidUser from the WFUser table) sent in the URL.

 

URL Example:

[Project_URL]/scim/v2/Users/MarkW

 

Using this URL you can update information of the MarkW user. If you have multiple domains you can send this parameter using this format:

 

userName@domain

 

Using the PATCH HTTP method you can perform any of the following operations:

 

Replacing: Changes the value in the XPath attribute.

Adding: Adds a new parameter in the schema. In Bizagi adding new parameters is not available. So invoking this method replaces the value in the XPath attribute if the attribute exists in the schema.

Removing: This removes the value of a parameter in the schema.

 

For this operation you need to send the following structure in the JSON structure:

 

{

  "schemas":[

     "urn:ietf:params:scim:api:messages:2.0:PatchOp"

  ],

  "Operations":[

     {

        "op":"[OperationType]",

        "path":"[Xpath]",

        "value":"[Value]"

     }

  ]

}

 

Where:

 

Variable

Description

OperationType

Set the operation type: replace, add, or remove.

Path

The XPath of the attribute where you are going to modify the value. The XPath is based on the structure of the schema, for example, name.middleName.

 

If this value is not provided, the value is ignored.

Value

Value of the item being modified. This item is not needed if you are going to remove an attribute.

 

The XPath depends on the attribute you want to update. Xpaths has the same structure used in user creation.  See Create a user.

 

You can also change more than one parameter in the same invocation. For example, if you want to update the FamilyName and the enabled for assignment property. For the name, the given name and the middle name must remain the same, and you only send  the new value of the family name. The final execution in POSTMAN looks like this:

 

{

  "schemas":[

     "urn:ietf:params:scim:api:messages:2.0:PatchOp"

  ],

  "Operations":[

     {

        "op":"replace",

        "path":"name.givenName",

        "value":"oldGivenName"

     },

     {

        "op":"replace",

        "path":"name.middleName",

        "value":"oldMiddleName"

     },

     {

        "op":"replace",

        "path":"name.FamilyName",

        "value":"NewFamilyName"

     },

     {

        "op":"replace",

        "path":"enabledForAssignation",

        "value":false

     }

  ]

}

 

The response is a JSON with the SCIM schema and the information saved in Bizagi.

 

In case of any error, the request is considered as an atomic action. This means that the record rollsback to its initial state and changes are not applied.

 

note_pin

Synchronization of User Properties is not available in Azure AD.

 

Updating email or phone number

SCIM standard allows multiple types of emails or phone numbers, for example, work email, or home email. However, in Bizagi you can only register one email or one phone. See considerations with emails and phones. Therefore, to update the email or phone number of a user, use the following structure:

 

{

  "schemas":[

     "urn:ietf:params:scim:api:messages:2.0:PatchOp"

  ],

  "Operations":[

 {

         "op": "replace",

         "path": "emails[type eq \"work\" or primary eq \"true\"]",

         "value": {

                 "value": "bjensen28@example.com",

                 "type": "work",

                 "primary": true

         }

 }

 ]

}

 

note_pin

In the Path property, you can only use one logical operator (OR or AND).

 

Removing values

You can remove values of parameters of the schema using the operation remove. Here is an example of removing the value of the parameter "phoneNumber"

 

{

  "schemas":[

     "urn:ietf:params:scim:api:messages:2.0:PatchOp"

  ],

  "Operations":[

     {

        "op":"remove",

        "path":"phoneNumbers"

     }

  ]

}

 

Removing the value means that is set as null.  If the path contains a non-existing parameter the action is ignored. If you try to remove mandatory fields, Bizagi returns an error, for example:

 

SCIM_14

 

The final execution in POSTMAN looks like this:

 

SCIM_15

 

Using Filters

You can use the same filters used to consult the information of users. See Get information of users using filters. However, consider the following:

 

The supported operators are "eq" and "gt".

You can use logical operators "or" or "and", but you can only use one logical operator.