UpdateUser (Site-Level)

You are here:

This method is used to update an existing user under the site associated with the request.

Authentication

Site-level methods always requires an authentication token. In addition to authentication token, these methods also requires the request IP to be whitelisted. For more information about whitelisting an IP, see API Whitelisting.

Request

Target Endpoint

POST /Api/Sites/UpdateUser

 

Parameters

Property Name

Type

Is Required?

Description

UserId Int Required Id of the user to be updated
UserName String Required Updated username of the requested user
RoleId Int Required Updated user role identifier of the requested user
GroupId Array of Int Required Updated groups that the user will belong to
LastName String Required Updated last name of the requested user
FirstName String Required Updated first name of the requested user
EmailAddress String Required Updated email Address of the requested user
Password String Required Updated password of user which should be compatible with site password policy
IsActive Boolean Required Used for setting the user active/inactive
SiteId Int Required The identifier of the target site
Request Sample

Headers

POST /Api/Sites/UpdateUser HTTP/1.1
Authorization: Bearer Do3l_2l3uLdmYX76u-BufLzuuhFPOE-nRZDyU0adiFk1
Content-Type: application/json
Host: dev7.pagos.com

Body (formatted)

{
       "UserId": 13,
       "UserName": "testUserApi",
       "RoleId": 1,
       "GroupId": [
             1
       ],
       "LastName": "test",
       "FirstName": "test",
       "EmailAddress": "test@pagos.com",
       "Password": "Abc123456$789",
       "IsActive": true,
       "SiteId": 1
}
Response

Property Name

Type

Description

Success Boolean Indicated whether or not the request passed the whitelisting and authentication based on the provided token and Site Id.
InvalidToken Boolean If the request is unsuccessful, indicates whether or not the failure was due to token.
Messages Array of String A list of messages, which can be used or captured for diagnostics. When requests are unsuccessful, the reason for the failure will be documented in the Messages list.
UserId String If the request was successful, ID assigned to the created user.
MethodResponse String If the user update failed due to provided user information, the reason for the failure will be documented, otherwise Null
Response Sample (Success)

Headers

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Content-Type: application/json; charset=utf-8

Body (formatted)

{
       "UserId": null,
       "MethodResponse": "User updated successfully.",
       "Success": true,
       "InvalidToken": false,
       "Messages": []
}
Response Sample (Authentication Failure)

Headers

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Content-Type: application/json; charset=utf-8

Body (formatted)

{
       "UserId": null,
       "MethodResponse": null,
       "Success": false,
       "InvalidToken": false,
       "Messages": [
             "The requested resource is restricted and your request did not provide a valid token."
       ]
}
Response Sample (Method Failure)

Headers

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Content-Type: application/json; charset=utf-8

Body (formatted)

{
       "UserId": null,
       "MethodResponse": "User cannot be assigned to these groups: System.Int32[] as they do not exist!",
       "Success": true,
       "InvalidToken": false,
       "Messages": []
}