Zeilen lesen
GET https://core.orbitype.com/api/sql/v1?sql=SELECT * FROM posts
X-API-KEY: YOUR_API_KEYAntwort:
[
{ "id": 1, "title": "Alpha" },
{ "id": 2, "title": "Bravo" }
]Filtern
GET https://core.orbitype.com/api/sql/v1?sql=SELECT * FROM posts WHERE id = :id&bindings[id]=2
X-API-KEY: YOUR_API_KEYEinfügen
POST https://core.orbitype.com/api/sql/v1
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
{
"sql": "INSERT INTO posts (title) VALUES (:title) RETURNING *",
"bindings": { "title": "Delta" }
}Antwort:
[ { "id": 4, "title": "Delta" } ]Ändern und löschen
POST https://core.orbitype.com/api/sql/v1
{
"sql": "UPDATE posts SET title = :title WHERE id = :id RETURNING *",
"bindings": { "id": 4, "title": "New title" }
}{
"sql": "DELETE FROM posts WHERE id = :id RETURNING *",
"bindings": { "id": 4 }
}sql ist erforderlich. bindings ist ein Objekt der Namen im Statement. Eine fehlende Tabelle liefert einen Datenbankfehler im Antworttext.