Fleetdock
API referenceDbadminDatabasesIdQuery

SQL query console

Runs one or more statements (split on `;` outside literals, comments and dollar quotes; MySQL `DELIMITER` lines are honoured) in order on one session, stopping at the first failure. Reads run as the database's read-only role; a script with any write runs as its read-write role and requires database:write (checked before anything runs). A failing first statement is returned as an error; a later failure returns the earlier results plus `error`. Pass `query_id` (a UUID you generate) to be able to cancel the run.

POST
/v1/databases/{id}/query

Runs one or more statements (split on ; outside literals, comments and dollar quotes; MySQL DELIMITER lines are honoured) in order on one session, stopping at the first failure. Reads run as the database's read-only role; a script with any write runs as its read-write role and requires database:write (checked before anything runs). A failing first statement is returned as an error; a later failure returns the earlier results plus error. Pass query_id (a UUID you generate) to be able to cancel the run.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*string
Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/v1/databases/497f6eca-6276-4993-bfeb-53cbbbba6f08/query" \  -H "Content-Type: application/json" \  -d '{}'
{  "results": [    {      "columns": [        "string"      ],      "rows": [        [          "string"        ]      ],      "row_count": 0,      "truncated": true,      "rows_affected": 0,      "read_only": true,      "duration_ms": 0    }  ],  "error": {    "statement": 0,    "message": "string"  }}