Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

API.Routes.Register

Mestre-Tramador edited this page Aug 18, 2022 · 1 revision

Register POST

/register

Passing valid data, a User can be created on the system.

Headers

Name Value Description
Content-Type application/json The User data shall be passed as JSON.

Request Body

{
  "name": "Exper User",
  "email": "unique.user@exper.com",
  "password": "exper-pswd"
}
Field Type Required Description
name string true The complete name of the User.
email string true A unique email to serve as identifier.
password string true The password to allow the authentication.

Response

201

{
  "user": {
    "id": 1,
    "name": "Exper Admin",
    "email": "admin@exper.com",
    "created_at": "2022-08-18T14:42:02.752Z",
    "updated_at": "2022-08-18T14:42:02.752Z"
  },
  "token": "eyJhbGciOiJIUzI1NiJ9.eyJwYXNzd29yZCI6ImV4cGVyMTIzIiwiZW1haWwiOiJhZG1pbkBleHBlci5jb20ifQ.hCVaxs2PcGbragrSPcycbRkVyDytE8SRbsw1n23U3mM",
}

Returns the User inserted data and also its unique ID and the JWT of the current session.

400

{
  "error": "There was an error saving the User!"
}

This error generally occurs when incorrect data format is sended.

422

{
  "field": [
    "First problem with the field.",
    "Second problem..."
  ]
}

Each one of the Request Body fields can be a key, with an array of strings detailing the errors.

Clone this wiki locally