Built-in endpoints
Sealious automatically creates endpoints for all the collections defined within
your app. All endpoins automatically take care of policy enforcement, so you
don't have to worry about implementing logic of who can do what. Just make sure
that the policies are set up properly for each collection and they will be
enforced.
User/Session management
Register:
POST /api/v1/collections/registration-intents
params: email
Starts user registration flow. THe user needs to confirm the email first, and
then is redirected to a form that lets them choose their username.
Log in:
POST /api/v1/sessions/
params: username, password
Attempts to log the user in. If the login is successfull, a cookie with session
ID is set. Otherwise, an error message in JSON form is returned.
Why isn't it just POST /api/v1/login? It's simply to mainain the REST-ful
semantics. When you log in, you actually want to create (POST) a new session
(/api/v1/sessions).
Log out:
DELETE /api/v1/collections/sessions/current
Deletes the current session from DB. No params needed
Request a password reset:
POST /api/v1/collections/password-reset-intents
params: email
Begins the password reset flow. If the email exists in the database, a message
with reset link is sent to the user.
Static forms
There routes set up for some static forms, including:
- GET /account-creation-details asks for user data when creating an account
- POST /finalize-registration-intent finishes user creation. /account-creation-details contains a form that POSTs to this endpoint.
- POST /finalize-password-reset
- GET /confirm-password-reset
Collection endpoints
Each collection gets a full REST-ful API endpoint. These endpoints work for both the collections created by you, as well as for all built-in collections:
- users
- sessions
- password-reset-intents
- registration-intents
- user-roles
- formatted-images
List all elements within the collection
GET /api/v1/collections/:collection_name
Query Params:
- filter - key/value. Maps field names to the desired values. Example: ?filter[name]=Hoover&filter[age][gt]=18
- sort - key/value. Forces the output to be sorted by given field. Example: ?sort[favorite_number]=desc. Sort order is desc or asc
- pagination - key/value. Keys are: page (which page to display), items (how many items per page), forward_buffer (return this many more additional items per page than specified in items. Useful when trying to establish whether or not there is a next page to display)
- attach - key/value. keys are field-names, values are field-type specific. Whether or not to fetch attachments related to given field, and in what form. Currently supported only by single-reference and reverse-single-reference field types.
- format key/value. Some fields can have different outputs depending on the provided format.
Examples
GET /api/v1/collections/seals?filter[name]=Hoover # show only seals named Hoover GET /api/v1/collections/seals?filter[object_field][weight]=280&sort[age]=asc # sort by age, filter by object_field.weight GET /api/v1/collections/seals?filter[name]=Hoover?pagination[items]=10&page=2 # 10 items per page, show items 11-20
File Metadata
- Mime Type
- text/plain
- Expires
- Tue, Jul 8, 07:03 (3 h, 9 m)
- Storage Engine
- blob
- Storage Format
- Raw Data
- Storage Handle
- 810365
- Default Alt Text
- endpoints.remarkup (3 KB)