CreateUser (Site-Level)

You are here:

This method is used to create a new 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/CreateUser

 

Parameters

Property Name

Type

Is Required?

Description

UserNameStringRequiredUsername of the requested user
RoleIdIntRequiredUser role identifier of the requested user
GroupIdArray of IntRequiredGroups that the user will belong to
LastNameStringRequiredLast name of the requested user
FirstNameStringRequiredFirst name of the requested user
EmailAddressStringRequiredEmail Address of the requested user
PasswordStringRequiredPassword of user which should be compatible with site password policy
SiteIdIntRequiredThe identifier of the target site
Request Sample

Headers

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

Body (formatted)

{
       "UserName": "testUserApi",
       "RoleId": 1,
       "GroupId": [
             1
       ],
       "LastName": "test",
       "FirstName": "test",
       "EmailAddress": "test@pagos.com",
       "Password": "Ab$123456789",
       "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 creation 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": 13,
       "MethodResponse": null,
       "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": "Email is in use. Please enter a different email!",
  "Success": true,
  "InvalidToken": false,
  "Messages": []
}