LightningWeb.API.UserController (Lightning v2.20.1)

Copy Markdown View Source

The users resource, for service accounts only.

POST /api/users takes a flat object of email, password, first_name, last_name, role (user or superuser) and confirmed, and refuses any other key with a 422 unknown_key entry at that key, alongside every other error in the body. It answers 201 with the new user. An email already taken in any case is a taken entry at #/email, which names nothing about the user who holds it.

PATCH /api/users/:id takes any of first_name, last_name, role, password and confirmed, with the same rules as a create, and refuses any other key the same way, email included, since the email can't be changed. It answers 200 with the user rendered as a 201 renders one. confirmed only ever confirms.

Either answers 400 malformed to a body that isn't a JSON object.

GET /api/users is paginated, at most 100 a page, and filters by ?email= without regard to case. An email that isn't a string answers 400 invalid_parameter.

Summary

Functions

create(conn, params)

index(conn, params)

show(conn, params)

update(conn, params)