Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Common READ attributes

Rafael Carneiro de Moraes edited this page Dec 16, 2019 · 1 revision

In both v2 and _v3_versions the API, when READing you can customize your response with the following optional attributes:

id

Returns all data given an PK value.

Ex:

  • id=20 returns all data from the row with the PK value of 20

orderBy

Orders your response by field (by default, the PK field of your table). You can order by multiple fields, just putting them in order of importance.

Ex:

  • orderBy=field1 orders by Field1
  • orderBy=field1+field2 orders by Field1 first, then by Field2.

orderDir

Defines an ordenation to your response (by default, DESC). You can combine this attribute with orderBy, but the quantity of directions should be paired to fields in orderBy or only one.

Ex:

  • orderBy=field1+field2&orderDir=asc+desc order by Field1 ascending, then by Field2 descending.
  • orderBy=field1+field2&orderDir=asc order by Field1 ascending, then by Field2 ascending.

limit

Defines the quantity of items in your response (by default, 30 items). It should be numeric or all to return all the data. Watch out: all could give you very slow/heavy responses depending on your table.

Ex:

  • limit=10 sets the number of items in your response to 10.
  • limit=all returns all the data from your table.

page

Defines the pagination/offset for your response (by default, 1st page). You can use it with limit to get another set of items in your response.

Ex:

  • limit=10&page=1 returns the first set of 10 orderned items
  • limit=10&page=2 returns the second set of 10 orderned items

search

Defines a search on your table. All search parameters are based on SQL operations. Multiple can be applied and they will be joined with an AND SQL operator.

Operation SQL equivalent Usage
: Field = Value field:value
!: Field <> Value field!:value
:: Field LIKE 'Value' field::value
!:: Field NOT LIKE Value field!::value
> Field > Value field>value
>: Field >= Value field>:value
< Field < Value field<value
<: Field <= Value field<:value
>< Field > Value1 AND Field < Value2 field><value1|value2
:>< Field >= Value1 AND Field < Value2 field:><value1|value2
><: Field > Value1 AND Field <= Value2 field><:value1|value2
:><: Field >= Value1 AND Field <= Value2 field:><:value1|value2
@ Field IN(Value1, Value2, ...) field@value1|value2|...
!@ Field NOT IN(Value1, Value2, ...) field!@value1|value2|...
* Field IS NULL field*
!* Field IS NOT NULL field!*
Clone this wiki locally