Skip to content

Commit e9e4f74

Browse files
authored
Answering #417
1 parent 8892e1c commit e9e4f74

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,59 @@ by adding a letter (a-f) you can create almost any reasonably complex condition
319319

320320
NB: You can only filter on the requested table (not on it's included) and filters are only applied on list calls.
321321

322+
### Column selection
323+
324+
By default all columns are selected. With the "include" parameter you can select specific columns. Multiple columns should be comma separated.
325+
An asterisk ("*") may be used as a wildcard to indicate "all columns". Similar to "include" you may use the "exclude" parameter to remove certain columns:
326+
327+
```
328+
GET /records/categories?include=name
329+
GET /records/categories?include=categories.name
330+
GET /records/categories?exclude=categories.id
331+
```
332+
333+
Output:
334+
335+
```
336+
{"categories":{"columns":["name"],"records":[["Web development"],["Internet"]]}}
337+
```
338+
339+
NB: Columns that are used to include related entities are automatically added and cannot be left out of the output.
340+
341+
### Ordering
342+
343+
With the "order" parameter you can sort. By default the sort is in ascending order, but by specifying "desc" this can be reversed:
344+
345+
```
346+
GET /records/categories?order=name,desc
347+
GET /records/categories?order[]=icon,desc&order[]=name
348+
```
349+
350+
Output:
351+
352+
```
353+
{"categories":{"columns":["id","name"],"records":[[3,"Web development"],[1,"Internet"]]}}
354+
```
355+
356+
NB: You may sort on multiple fields by using multiple "order" parameters.
357+
358+
### Pagination
359+
360+
The "page" parameter holds the requested page. The default page size is 20, but can be adjusted (e.g. to 50):
361+
362+
```
363+
GET /records/categories?order=id&page=1
364+
GET /records/categories?order=id&page=1,50
365+
```
366+
367+
Output:
368+
369+
```
370+
{"categories":{"columns":["id","name"],"records":[[1,"Internet"],[3,"Web development"]],"results":2}}
371+
```
372+
373+
NB: Pages that are not ordered cannot be paginated.
374+
322375
### Joins
323376

324377
Let's say that you have a posts table that has comments (made by users) and the posts can have tags.

0 commit comments

Comments
 (0)