SQL API
Für SQL-Connectoren stellt die API einen Endpunkt bereit, um vorbereitete SQL-Anweisungen auszuführen.
Die HTTP-Methode gibt die Absicht vor, aber du kannst jede gültige Kombination aus sql
und bindings
übergeben.
Table of contents:
Index
Nutze eine SELECT
-Anweisung, um eine Liste von Zeilen abzurufen.
http request GET https://core.orbitype.com/api/sql/v1?sql=SELECT * FROM posts
Antwort:
[
{
"id": 1,
"title": "Alpha"
},
{
"id": 2,
"title": "Bravo"
},
{
"id": 3,
"title": "Charlie"
}
]
Anzeigen
Nutze eine WHERE
-Klausel, um das Ergebnis einzuschränken.
http request GET https://core.orbitype.com/api/sql/v1?sql=SELECT * FROM posts WHERE id = :id &bindings[id]=2
Antwort:
[
{
"id": 2,
"title": "Bravo"
}
]
Erstellen
Nutze eine INSERT
-Anweisung, um eine neue Zeile zu erstellen.
http request POST https://core.orbitype.com/api/sql/v1
{
"sql": "INSERT INTO posts (title) VALUES (:title) RETURNING *",
"bindings": {
"title": "Delta"
}
}
Antwort:
[
{
"id": 4,
"title": "Delta"
}
]
Aktualisieren
Nutze eine UPDATE
-Anweisung, um eine bestehende Zeile zu ändern.
http request POST https://core.orbitype.com/api/sql/v1
{
"sql": "UPDATE posts SET title = :title WHERE id = 4 RETURNING *",
"bindings": {
"title": "Neuer Titel"
}
}
Antwort:
[
{
"id": 4,
"title": "Neuer Titel"
}
]
Löschen
Nutze eine DELETE
-Anweisung, um eine bestehende Zeile zu entfernen.
http request POST https://core.orbitype.com/api/sql/v1
{
"sql": "DELETE FROM posts WHERE id = :id RETURNING *",
"bindings": {
"id": 4
}
}
Antwort:
[
{
"id": 4,
"title": "Delta"
}
]