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

UserIdIntRequiredId of the user to be updated
UserNameStringRequiredUpdated username of the requested user
RoleIdIntRequiredUpdated user role identifier of the requested user
GroupIdArray of IntRequiredUpdated groups that the user will belong to
LastNameStringRequiredUpdated last name of the requested user
FirstNameStringRequiredUpdated first name of the requested user
EmailAddressStringRequiredUpdated email Address of the requested user
PasswordStringRequiredUpdated password of user which should be compatible with site password policy
IsActiveBooleanRequiredUsed for setting the user active/inactive
SiteIdIntRequiredThe 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

SuccessBooleanIndicated whether or not the request passed the whitelisting and authentication based on the provided token and Site Id.
InvalidTokenBooleanIf the request is unsuccessful, indicates whether or not the failure was due to token.
MessagesArray of StringA 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.
UserIdStringIf the request was successful, ID assigned to the created user.
MethodResponseStringIf 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": []
}