Create User
1. Introduction
User profiles can be created via the API. This user can be used in normal operation as any other user that was created manually. This can usually be used when an application is creating a user remotely. Usually, this is a remote terminal, recharge terminal or any other custom application.
2. Prerequisites
REST API application in MyQ → Settings → External Systems has to have access to scope called Users.
3. Calling the API
The endpoint is defined as:
Endpoint:
POST /v2/users
Authentication:
Grant_type: client_credentials
Scopes: [ users ]
Headers:
Content-Type: application/json
Authentication: Bearer %access_token%
Body:
{
"username": "string",
"fullname": "string"
}
Note that the %access_token%
needs to be replaced by the token you received as a response from auth endpoint.
From the definition, we can see that username
and fullname
are the only required parameters. There can be many more parameters defined. They can be found on the Endpoint page under the /v3/users
endpoint.
4. Response
Code:
2xx
Response:
{
"id": 0,
"username": "string",
"fullname": "string"
}
If the endpoint was called correctly with correct parameters. The response code should be 2xx and the body should include a JSON with id
of a created user. This number should be saved locally and can be used in other endpoints to edit or generate a PIN for this user. If the status code is 4xx the user probably already exist or there is some other problem. See Errors messages page.