Skip to content

Users endpoint

Kirill Ponomarev edited this page Mar 22, 2023 · 4 revisions

General info about the endpoint

The Users endpoint enables sign up procedure and return of information about the current user. Following operations are available:

HTTP Method Description
POST Create new user (sign up procedure)
GET Get current user

Request/Response

The API accepts and returns JSON. The request and response for each operation is described below.

Create new user (sign up procedure)

POST /users

Request (JSON Body)

Parameter Type Required Nullable Description
id string Yes No The ID of the new user
email string Yes No The email of the new user
master_password_hash string Yes No The master password hash of the new user
hint string No No The hint of the new user to reset master password

Response

HTTP Status Code Response Body
201 {
"message": { "success": "User created successfully <user_id>" } }
409 { "message": { "error": "Resource Already Exists. User with id <user_id> already exists" } }
409 { "message": { "error": "Resource Already Exists. User with this email already exists" } }
400 { "message": { "email": "This JSON body argument is missing at all or it's value is null" } }
400 { "message": { "email": "This JSON body argument is an empty string"} }
422 { "message": { "error": "Unprocessable Entity. Error while sending an email. The recipient address probably not valid" } }

Get current user

GET /users

Authentication

This request requires authentication, token recieved after login procedure included in x-access-token header.

Request

This request body does not require a request body or query parameters.

Response

{  "id": "example_id",  "email": "example_email",  "hint": "example_hint" }