Skip to main content
Version: v0.14

Custom Endpoints

Conduit attempts to help you cut back on boilerplate code.
Besides offering support for optional auto-generated CRUD endpoints for your custom schemas, it also provides the means for you to construct powerful functional endpoints, allowing you to effortlessly operate on your backend without having to write any code whatsoever.

These endpoints are schema-based, meaning they make use of a specific schema's entries.
Both system and custom schemas are supported.

Creating Endpoints

Bring up the Admin Panel and navigate to the Database section.
Then head to the Custom Endpoints tab.

Custom Endpoints Panel

Let's show you around the place.
Here's a rundown of the base fields and options making up a custom endpoint:

  • Name to be used as the endpoint's name
  • Authenticated defines whether endpoint requires user authentication
  • Operation to be used for the endpoint
  • Schema to be used for the endpoint

Find/Get operations additionally offer the following options:

  • Paginated defines whether endpoint should provide pagination (skip/limit)
  • Sorted defines whether results should be sorted

Custom Endpoints Panel

Upon selecting your request type, the page is updated with the appropriate sections to be used while defining your endpoint's behavior.

Inputs

Add Input

If you wish to, you may conditionally operate on your data based on variable fields.
Here's what makes up an input:

  • Name to be used while referring to this field in the followup sections
  • Type specifies the type of the field
  • Location defines whether the field should be a query, body or url param
  • Array defines whether the field should be an array
  • Optional defines whether the field should be optional

Queries

Add Query

You're going to have to specify at least one query condition for your endpoint.
Queries require a schema field to be compared against as well as a condition, comparing that field to a specific value (or a set of values).
These values may be defined through any of the following:

  • System Values are internal context values (middleware-dependent)
  • Custom Values may be provided during endpoint creation (hardcoded)
  • Schema Fields are existing fields from the target schema
  • Input Fields are defined in the Inputs section

The SQL-style Like operator is also supported.

Query condition checks can be ANDed or ORed.
They may also be nested however you see fit.

Assignments

While creating or updating a schema doc entry, you're going to have to specify the values for your schema fields.
Create and Update/Edit operations require that you specify all schema fields, whereas Patch ones let you partially update an existing schema document.

Assignment definitions include the following fields:

  • Schema Field to be populated
  • Action to be used for the operation
  • Assignment Value to be used while populating the field

A field may be populated through any of the following actions:

  • SET populates the field with target assignment value
  • INCREMENT increments the field by target assignment value
  • DECREMENT decrements the field by target assignment value
  • APPEND appends the target assignment value to an array field
  • REMOVE removes the target assignment value from an array field

Similarly to how Queries operate, assignment values may come from: