Chelabase
ManagementSql editor

Update a saved SQL query

PATCH
/v1/databases/{id}/sql-queries/{query_id}

Changes the given fields of one of the caller's saved queries (an Admin may change any). version must be the version last seen; the version goes up by one with each change. pg_database and role accept null to clear them.

Authorization

bearer
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Database id

Formatuuid
query_id*string

Saved query id

Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

name?string|null
pg_database?|

null or "" clears the hint; absent leaves it.

role?|

null or "" clears the hint; absent leaves it.

sql?string|null
version*integer

The version the client last saw; a mismatch answers 409 saved_query_conflict.

Formatint32

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://example.com/v1/databases/497f6eca-6276-4993-bfeb-53cbbbba6f08/sql-queries/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "Content-Type: application/json" \  -d '{    "version": 0  }'
{  "created_at": "2019-08-24T14:15:22Z",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "name": "string",  "pg_database": "string",  "role": "string",  "sql": "string",  "updated_at": "2019-08-24T14:15:22Z",  "version": 0}