Skip to content
v0.5.1GitHub

Using

Executes exactly one LuraSQL statement against `domain` and returns its typed result. `expand` resolves REFERENCES columns of a SELECT into embedded objects (or `"*"` for every REFERENCES column).

applies to v0.5.1
POST
/store-api/rel/{domain}/sql
curl --request POST \
--url https://example.com/store-api/rel/example/sql \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "expand": [ "example" ], "params": [ {} ], "sql": "example" }'
domain
required
string

Relational domain

Media typeapplication/json
object
expand

REFERENCES columns to resolve into embedded objects, or ["*"] for all of them. Only valid for SELECT; non-empty on DML/DDL → 400.

Array<string>
params

Positional parameters (JSON array), bound to the ? placeholders. Omitted ⇒ empty array.

Array<object>
object
sql
required

Exactly one LuraSQL statement (more → 400 MultipleStatements).

string

Example generated

{
"expand": [
"example"
],
"params": [
{}
],
"sql": "example"
}

Statement result. Shape depends on the statement class — DDL: {“ok”:true}; INSERT/UPDATE/DELETE: {“affected”,“last_pk”}; SELECT: {“columns”:[{“name”,“type”}],“rows”:[[…]],“row_count”,“limit_applied”,“expanded”?}. rows are arrays (not objects) so same-named JOIN columns don’t collide.

Media typeapplication/json
object

Example generated

{}

Syntax, type, parameter-count, or expand error

Media typetext/plain
string

Access level too low for this statement

Media typetext/plain
string

Domain, table, column, or index not found

Media typetext/plain
string

Conflict — duplicate key, unique violation, name collision, …

Media typetext/plain
string

Domain is being deleted

Media typetext/plain
string

Response exceeds max_response_bytes

Media typetext/plain
string

Per-domain request budget exceeded

Media typetext/plain
string

Relational engine disabled

Media typetext/plain
string

Insufficient Storage — disk space or memory runs short; the write was not applied. Reads go on; retry after the seconds in Retry-After.

Media typetext/plain
string
Retry-After
integer