Index
Use a SELECT statement to fetch a list of rows.
http request GET https://core.orbitype.com/api/sql/v1?sql=SELECT * FROM postsResponse:
[
{
"id": 1,
"title": "Alpha"
},
{
"id": 2,
"title": "Bravo"
},
{
"id": 3,
"title": "Charlie"
}
]Show
Use a WHERE clause to filter it down.
http request GET https://core.orbitype.com/api/sql/v1?sql=SELECT * FROM posts WHERE id = :id &bindings[id]=2Response:
[
{
"id": 2,
"title": "Bravo"
}
]Create
Use an INSERT statement to create a new row.
http request POST https://core.orbitype.com/api/sql/v1
{
"sql": "INSERT INTO posts (title) VALUES (:title) RETURNING *",
"bindings": {
"title": "Delta"
}
}Response:
[
{
"id": 4,
"title": "Delta"
}
]Update
Use an UPDATE statement to change an existing row.
http request POST https://core.orbitype.com/api/sql/v1
{
"sql": "UPDATE posts SET title = :title WHERE id = 4 RETURNING *",
"bindings": {
"title": "New title"
}
}Response:
[
{
"id": 4,
"title": "New title"
}
]Destroy
Use a DELETE statement to remove an existing row.
http request POST https://core.orbitype.com/api/sql/v1
{
"sql": "DELETE FROM posts WHERE id = :id RETURNING *",
"bindings": {
"id": 4
}
}Response:
[
{
"id": 4,
"title": "Delta"
}
]