Create User #
Creates a new User assigned to a Customer tenant.
POST /v1.0/accounts/{ACCOUNT_TENANT_ID}/customers/{CUSTOMER_TENANT_ID}/users
Remarks #
Whenever a new User is created they will be given the "customer.user" role that allows them to login to the Customer portal. This will also send out an activation email to the address provided as soon as the User is created.
Example #
This request will create a new User with the following details:
- Customer: Within the Customer tenant with id of {CUSTOMER_TENANT_ID}
- Email: [email protected]
- Display name: "New User",
- Roles:
- User Administrator (admin.user)
- Website User (customer.user)
- Reporter Supervisor Level (customer.user.supervisorl1)
- Customer Settings (customer.settings)
Request #
POST <https://api.na.myreports.cloud/api/v1.0/accounts/{ACCOUNT_TENANT_ID}/customers/{CUSTOMER_TENANT_ID}/users> HTTP/1.1
Content-Type: application/json
accept-charges: true
Authorisation: Bearer {TOKEN}
Connection: keep-alive
{
"email": "[[email protected]](mailto:[email protected])",
"displayName": "New User",
"roles": ["admin.user", "customer.user", "customer.user.supervisorl1", "customer.settings"]["admin.user", "customer.user", "customer.user.supervisorl1", "customer.settings"]
}
Response #
HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8
Content-Length: xx
Location: <https://api.na.myreports.cloud/api/v1.0/accounts/{ACCOUNT_TENANT_ID}/customers/{CUSTOMER_TENANT_ID}/users/{USER_ID}>
{
"data": {
"id": "{USER_ID}",
"displayName": "New User",
"email": "[[email protected]](mailto:[email protected])",
"primaryTenant": "{CUSTOMER_TENANT_ID}",
"roles": ["admin.user", "customer.user", "customer.user.supervisorl1", "customer.settings"]["admin.user", "customer.user", "customer.user.supervisorl1", "customer.settings"]
},
"status": "success",
"timestamp": "2019-11-29T16:03:23.9251680Z"
}
Errors #
Unauthorised #
When the token is not provided, invalid or expired
HTTP/1.1 401 Unauthorised
Bad Request #
When the provided tenant id is not in the correct format
HTTP/1.1 400 Bad Request
Date: Thu, 06 Feb 2020 12:45:27 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 149
{
"error": 400,
"message": "The value '<tenant id>' is not valid.",
"status": "error",
"timestamp": "2020-02-06T12:45:27.5903465Z"
}
When the amount of User licences has been exceeded
HTTP/1.1 400 Bad Request
Date: Thu, 06 Feb 2020 12:45:27 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 149
{
"error": 400,
"message": "Not enough user licences available.",
"status": "error",
"timestamp": "2020-02-06T12:45:27.5903465Z"
}
Not Found #
When there are no Customers that have a matching tenant id
HTTP/1.1 404 Not Found
Date: Thu, 06 Feb 2020 12:46:58 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 95
{
"error": 404,
"message": "Not Found",
"status": "error",
"timestamp": "2020-02-06T12:46:58.7669535Z"
}
Payment Required #
If this request may incur any additional charges, see Charges.
HTTP/1.1 402 Payment Required
Date: Thu, 06 Feb 2020 13:01:00 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 274
{
"data": {
"id": "{USER_ID}",
"displayName": "New User",
"email": "[[email protected]](mailto:[email protected])",
"primaryTenant": "{CUSTOMER_TENANT_ID}",
"roles": ["admin.user", "customer.user", "customer.user.supervisorl1", "customer.settings"]["admin.user", "customer.user", "customer.user.supervisorl1", "customer.settings"]
},
"error": 402,
"message": "additional charges apply",
"status": "error",
"timestamp": "2020-02-06T13:01:01.1302340Z"
}
Conflict #
If the email address for this new user already exits for another user in this Customer tenant
HTTP/1.1 409 Conflict
Date: Thu, 06 Feb 2020 13:05:39 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 178
{
"error": 409,
"errorCode": "EmailConflict",
"message": "A user with the email address [[email protected]](mailto:[email protected]) already exists.",
"status": "error",
"timestamp": "2020-02-06T13:05:39.5486342Z"
}