Application Initialization
To begin using the Lagertha API, you need to perform several initialization operations:
- Create a
ROLE_SUPER_ADMIN
user - Create the first application
- Create a
ROLE_ADMIN
user for the application
Creating the ROLE_SUPER_ADMIN User
Create the super user and perform the initial setup:
make init
The login information for the user will be displayed in the console. Make sure to save the following details:
login
password
application_id
.
You will need these credentials to log in.
Creating the First Application
To create the first application, use the following command:
make create_application NAME=<application_name> EMAIL=<contact_email>
The new application's information will be displayed in the console.
Creating the First ROLE_ADMIN User
Once the first application is created, you need to create a ROLE_ADMIN
user for it.
Authenticating the ROLE_SUPER_ADMIN User
AAuthenticate with the API using the previously created ROLE_SUPER_ADMIN
user:
curl -X POST https://<BASE_URL>:<PORT>/auth \
-H "Content-Type: application/json" \
-d '{
"login": "<LOGIN_SUPER_ADMIN>",
"password": "<PASSWORD_SUPER_ADMIN>",
"application_id": 0,
"fingerprint": "<UNIQUE_DEVICE_ID>"
}'
f you are using self-signed certificates, add --insecure
to the curl command.
Retrieve the access_token
from the response.
Creating the ROLE_ADMIN User
Create the ROLE_ADMIN
user for the new application using the API:
curl -X POST https://<BASE_URL>:<PORT>/users \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <access_token>" \
-H "X-NONCE: <RANDOM_NONCE>" \
-H "X-FINGERPRINT: <UNIQUE_DEVICE_ID> \
-d '{
"email": "<NEW_USER_EMAIL>",
"password": "<NEW_USER_STRONG_PASSWORD>",
"firstname": "<USER_FIRSTNAME>",
"lastname": "<USER_LASTNAME>",
"login": "<NEW_USER_LOGIN>",
"application_id": <NEW_USER_APPLICATION_ID>,
"is_admin": true
}'
If you are in dev
mode, the X-NONCE
and X-FINGERPRINT
headers are not necessary.
Congratulations! Your first ROLE_ADMIN
user is now created, and you are ready to use the API.