-
Notifications
You must be signed in to change notification settings - Fork 0
User_reg
The /users/register
endpoint is used to create a user with the guest
role.
🚨ONLY SEND REQUESTS VIA A HTTPS CONNECTION! 🚨
In the near future the API will only accept https calls.
Send a POST request
to the /users/register
endpoint. This endpoint requires this data:
-
first_name
(required, string, max:191) -
insertion
(nullable, string, max:191) -
last_name
(required, string, max:191) -
email
(required, email with existing domain, max:191, unique in users table) -
postal_code
(required, NL,BE or DE postal code) -
password
(required, string, max:191)
This is a working example for the body text:
{
"first_name":"Harrie",
"insertion":"van",
"last_name":"Tiggelen",
"email":"[email protected]",
"postal_code":"5673RE",
"password":"SweetKittens23#"
}
If the user is created you will receive a 201 Created
status and receive the following JSON response:
{
"first_name": "Harrie",
"insertion": "van",
"last_name": "Tiggelen",
"email": "[email protected]",
"postal_code": "5673RE",
"password": "secret",
"role": "guest"
}
You receive this data to use it on a please verify your email
page.
If the user registration fails you will receive a 422 Unprocessable Entity
status and a JSON response (containing the problem) similar to this one:
{
"message": "The given data was invalid.",
"errors": {
"email": [
"The email has already been taken."
]
}
}
The api/users/validation
is a POST
endpoint. It's used to validate the users email address.
In the body you have to include 2 things:
-
email
(required, email, max:191) - The users email address. -
token
(required, integer) - The token, the user entered.
If the email and token match, the users account will be validated. You will receive a 201 Created
status and this JSON response:
{
"message": "Validated"
}
If the email and token do not match you will receive a 401 Unauthorized
status and this JSON response:
{
"message": "Token is incorrect"
}
If the email is already validated you will receive a 409 Conflict
and this JSON response:
{
"message": "The email is already validated"
}