-
Notifications
You must be signed in to change notification settings - Fork 2
REST API Documentation
The REST request are directly mapped to the tables, or views. A table/view name is of the form: <table-name> := [<schema-name>.]<name-of-the-view-or-table>. We will use the term table to refer to both table and view (including schema or not).
GET /data/<table-name>
Request
See [#filter] on how to filter data you want to retrieve.
Response
HTTP/1.1 200 OK
[
{
"id": "03c591e3-24bf-4633-ac09-de6eb0c14605",
"name": "John"
},
{
"id": "c4f23a88-39bf-4be6-8039-09ce559e7a37",
"name": "John"
}
]Example
GET /data/users?limit=2&name=like::J*
[{"name": "John", "age": 22}, {"name": "Jessie", "age": 30}]POST /data/<table-name>
Request
-
Headers:
- Content-Type: application/json
Response
HTTP/1.1 200 OK
[
{
"id": "16261dec-267d-439d-941d-5c75eec24225",
"name": "Xidada",
"data": {},
"created_at": "2015-07-31T04:34:13.973Z",
"updated_at": "2015-07-31T04:34:13.973Z"
}
]Example
POST /data/users
Content-Type application/json
{
"name": "Joe",
"age": 21
}
[{"name": "Joe", "age": 21}]PATCH /data/<table-name>
Request
- See [#filter] on how to filter data you want to update. You must provide a filter, you cannot mass update a whole table!
-
Headers:
- Content-Type: application/json
The data you updated will be returned.
Response
HTTP/1.1 200 OK
[
{
"id": "03c591e3-24bf-4633-ac09-de6eb0c14605",
"name": "John"
},
{
"id": "c4f23a88-39bf-4be6-8039-09ce559e7a37",
"name": "John"
}
]Example
PATCH /data/users?name=eq::Jessie
Content-Type application/json
{
"age": 23
}
[{"name": "John", "age": 22}, {"name": "Jessie", "age": 23}]DELETE /data/<table-name>
Request
- See [#filter] on how to filter data you want to delete. You must provide a filter, you cannot mass delete a whole table!
Response
The data you deleted will be returned.
HTTP/1.1 200 OK
[
{
"id": "03c591e3-24bf-4633-ac09-de6eb0c14605",
"name": "John"
},
{
"id": "c4f23a88-39bf-4be6-8039-09ce559e7a37",
"name": "John"
}
]Example
GET /data/users?name=eq::John
[{"name": "John", "age": 22}]You can filter the data to retrieve, update using the following url parameters:
-
Literally any column that is in the table, this can be queried using
column=operator::value(e.g. name=eq::). Possible operator are:- eq: equal
- neq: non equal
- gt: greater than
- gte: greater or equal than
- lt: less than
- lte: less or equal than
- like: like (specify a pattern using wildcard ) (e.g. name=like::T, get all the name that starts with T)
- ilike: case insensitive version of like
-
order If you want to specify the order on a column order=column::asc or order=column::desc
-
limit If you want to limit the result
- 500 Error: For unexpected errors, on prod the message shouldn't contain any useful information
- 400 Bad Request: If a required parameter is missing or malformed
- 404 Not Found: If the table or view does not exist
- 401 Unauthorized: If you are not authorized to see this content, and need to authenticate first
- 403 Forbidden: If you have authenticated but you do not have permission to see the content