SQL API

For SQL connectors, the API exposes an endpoint to execute prepared SQL

statements. The HTTP Method conveys intention, but you may pass any valid

combination of sql and bindings.

Index

Use a SELECT statement to fetch a list of rows.

http request GET https://core.orbitype.com/api/sql/v1?sql=SELECT * FROM posts

[
  {
    "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]=2

[
  {
    "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"
  }
}

[
  {
    "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"
  }
}

[
  {
    "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
  }
}

[
  {
    "id": 4,
    "title": "Delta",
  }
]

Learn more

Cookbook - Sections

Modern webpages are often composed of many different sections.

Things like hero banners, testimonials, FAQs or simple text blocks.

Developers implement these as reusable components with props.

But how do we allow non-technical people to use them in Orbitype?