Skip to main content

REST API

An alternative to the JS SDK to connect to your backend is through the REST API.

The slug of the entity is by default the plural dasherized name of the entity, but you can change it in the params

All entities start with the api/dynamic prefix. Ex: http://localhost:1111/api/dynamic/cats

GET /slug​

Gets a list of items from an entity.

Filters​

You can filter by property to refine the list of items. Use suffix to pass logic to it:

SuffixDescriptionExample
_eqequalsisActive_eq=true
_gtgreater thanbirthdate_gt=2020-01-01
_gtegreater than or equalage_gte=4
_ltless thanamount_lt=400
_lteless than or equalamount_lte=400
_likelikename_like=%bi%
_inincluded incustomer_in=1,2,3

By default the results are ordered by id in a DESC order and thus shows the new ones first.

Relations​

Load relations​

You can specify the relations you want to load. Eager relationships are loaded by default.

// Loads cats and their owners.
GET http://localhost:1111/api/dynamic/cats?relations=owner

// Coma-separated relations.
GET http://localhost:1111/api/dynamic/invoices?relation=project,customer

// Nested relations.
GET http://localhost:111/api/dynamic/city?relations=region,region.country

Filter by relations​

Once the relation is loaded, you can also filter by its properties using the same filters suffixes:

GET http://localhost:1111/api/dynamic/cats?relations=owner&owner.id_eq=1
GET http://localhost:1111/api/dynamic/cats?relations=owner&owner.name_eq=Jorge

Pagination​

All list requests are paginated by default. Just use the page parameter to chose your page and the perPage param if you want to change the number of items per page.

// Response format.
{
data: [{...}, {...}],
currentPage: 1,
lastPage: 10,
from: 1,
to: 10,
total: 100,
perPage: 10
}
ParamDescriptionExample
pageThe number of the page requestedpage=3
perPageThe number of items of each pageperPage=40

Order​

Order your list by a defined property.

ParamDescriptionExample
orderByThe name of property you want to order by.orderBy=age
orderAscending 'ASC' or Descending 'DESC'order=DESC

GET /slug/:id​

Get a single item.

POST /slug​

Create a new item.

Provide a Request Payload in JSON:

{
"age": 2
"name": "Milo"
}

PUT /slug/:id​

Update an item.

Provide a Request Payload in JSON:

{
"age": 2
"name": "Milo"
}

DELETE /slug/:id​

Delete an item.