Query a site's database
Changed onRun SQL against a site's database.
Against production this reads only — SELECT, WITH, PRAGMA, EXPLAIN. A write here would leave no record of what ran, no restore point and nobody asked, so data changes go through db/migrate and shape changes go through the development database and a deploy.
The development database accepts anything: it holds no contact data, and experimenting on it is what it is for.
Request
- Base URLhttps://api.crevio.co/v1
- AuthAPI key in header Authorization
Path parameters
The resource's ID, as returned in its id field
Headers
Makes this write safe to retry: a repeat with the same key replays the first response instead of creating a second resource. Scoped to the account, remembered for 24 hours; reusing a key with a different payload is an error.
Request body
The SQL to execute. Multiple statements may be separated by ; — the last statement that returns rows is surfaced.
Which database to use. A site normally has exactly one, production, and that is the default — the live database the site reads. development is only valid if a separate development database has been provisioned for this site; asking for one that doesn't exist is an error rather than a silent fall back to production. The response echoes the environment that was used.
Response
Query result
Always "database_query_result".
The rows returned by the query, each an object keyed by column name.
Number of rows returned.
Execution metadata for the surfaced statement (e.g. rows read/written, duration).
Changes
- warning
added the new
idempotency_errorenum value to theerror/typeresponse property for the response status - warning
added the new
idempotency_errorenum value to theerror/typeresponse property for the response status - warning
added the new
idempotency_errorenum value to theerror/typeresponse property for the response status
2 more changes in this revision
- warning