With our REST API, you can manage your users. If you want to do this automatically, you can write scripts in your preferred language. A few examples that are automated could include: creating, deactivating, activating, and deleting users.
The complete user documentation for our Cloud can be found here.
If you’re using On-Premises, you’ll find the documentation in your installation. Please customize the following URL:
https://<Your COYO domain>/docs/restdoc/guide/users
We explain creating and deleting a user below.
Prerequisites
First, you need to authenticate yourself with your Haiilo users via our OAuth2 interface in order to obtain your access token. This access token is used to authenticate your subsequent queries.
Note:
Please note that you have the same permissions in the API as when logging in via the web. So, it makes a difference whether you have activated moderator mode or are logged in as a super-admin.
curl -x POST https://<your-coyo-domain>/api/oauth/token?grant_type=password&username=<loginName>&password=<password>
Authorization: api-CLIENT-ID:CLIENT-SECRET
Replace the following data with yours:
<your-coyo-domain>
<loginName>
<password>
Example answer:
{
"access_token": "d3cd7b86-234b-4037-9f9f-6083b4df355e",
"token_type": "bearer",
"refresh_token": "aa2c35f7-4448-46af-94d5-6427d777ada7",
"expires_in": 3599,
"scope": "read write"
}
If you use a tool such as Postman, you can select the authentication method bearer token and insert the token there.
curl -x POST https://<your-coyo-domain>/api/users?access_token=197801e3-08b8-4007-a3df-3b64152972d3
Create user
Perform a POST at /api/users and insert the user information as json body (application/json).
Example of a query:
curl -x POST https://<your-coyo-domain>/api/users?access_token=197801e3-08b8-4007-a3df-3b64152972d3
Example request text:
{
"email" : "email@coyo4.com",
"loginName" : null,
"loginNameAlt" : null,
"firstname" : "First Name",
"lastname" : "Last Name",
"active" : true,
"superadmin" : true,
"groupIds" : [ "c7ea28be-4e2e-4571-945b-d0b3be84af35" ],
"roleIds" : [ "ac368349-6874-4cd2-843c-e9f309ab3f99" ],
"remoteLogonName" : null,
"password" : "SomePassword_123!",
"welcomeMail" : false,
"generatePassword" : false,
"initialUser" : false
}
Delete user
Execute the command DELETE at /api/users/{id}
Example of a query:
curl -x DELETE https://<your-coyo-domain>/api/users/172fed3f-52c9-40e4-8ccf-c785934c5630?access_token=197801e3-08b8-4007-a3df-3b64152972d3