CreateUser (Site-Level)
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 |
---|---|---|---|
UserName | String | Required | Username of the requested user |
RoleId | Int | Required | User role identifier of the requested user |
GroupId | Array of Int | Required | Groups that the user will belong to |
LastName | String | Required | Last name of the requested user |
FirstName | String | Required | First name of the requested user |
EmailAddress | String | Required | Email Address of the requested user |
Password | String | Required | Password of user which should be compatible with site password policy |
SiteId | Int | Required | The 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 |
---|---|---|
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 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": [] }