Almost all of our API operations require authentication with a token and to get that token you must use this login operation. The token is valid for 24 hours.
To get a token you may send a POST query to https://nacp01.noraina.net/api/login with a JSON payload like the one below:
{
"mail": "{{user}}",
"password": "{{pass}}"
}
If authentication succede you will get a JSON response similar to the one below:
{
"status": "success",
"data": {
"message": "Login successful.",
"token": "xxxxxxxxxxxxxxxxxxxx[...]"
}
}
As an example, here is how you can login to our plattform using curl:
curl --location --request POST 'https://nacp01.noraina.net/api/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"mail": "user",
"password": "password"
}'
And the corresponding response would look like this:
{
"status": "success",
"data": {
"message": "Login successful.",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}
}
If the authentication fails, you will get an error response like the one that follows:
{
"status": "fail",
"data": {
"message": "Attempt to login by user failed.",
"error": "Invalid user and/or password."
}
}