The Studio's HTTP API
The endpoints of the /v1 admin and query API that the Studio uses, which are implemented, and which are only a draft.
The Studio talks to the server over HTTP on the same port as the binary protocol (the first four bytes tell HTTP from a binary
frame). The contract is the API design document, marked DRAFT: changes are expected, and every change bumps api.minor. Base path
/v1. Every response carries x-rdb-request-id.
Naming#
Databases contain tables; a table has columns, rows, indexes and a primary key (key). collections and fields are deprecated aliases
for tables and columns; the Studio uses only the new names.
Implemented endpoints (API minor 2)#
| Endpoint | Meaning |
|---|---|
GET /v1/server | version, node role, replication and sync state |
GET /v1/auth/info (public) | {required, passwordLogin, token} |
POST /v1/auth/login {user, password} | {token, user, expiresInSeconds: 28800}; wrong credentials give 401 after 250 ms |
POST /v1/auth/logout, GET /v1/auth/whoami | end the session; user, roles, grants |
GET/POST /v1/databases | list, create (201; 409 exists; 400 bad name) |
GET/POST /v1/databases/{db}/tables | list tables with rows and bytes; create |
GET /v1/databases/{db}/tables/{t} | columns, indexes, primary key, sizes |
GET .../tables/{t}/stats | per shard rows, arena bytes, garbage bytes |
POST .../tables/{t}/indexes {column, kind} | create an index (ordered or hash) |
POST .../tables/{t}/documents {key, document}; GET, DELETE .../documents/{key} | write, read, delete one row |
POST .../tables/{t}/import | NDJSON, under 1 MiB and 20,000 lines |
POST /v1/query {db, table, language, text, pageSize, cursor, count} | {rows, keys, next, done, limit?} or {count} |
DELETE /v1/databases/{db}, .../tables/{t} | drop; body must be {"confirm":"<exact name>"}; main and main.documents are protected (409) |
POST .../rename {name} | rename a database or table |
POST .../tables/{t}/checkpoint | rewrite the table's logs now |
POST /v1/promote | on a replica: stop replicating and accept writes |
GET /v1/stats | uptime, open connections, table and row counts |
Roles are readonly < readwrite < admin; a refused call is 403 forbidden. On a replica every write except promote is
403 read_only_replica.
Errors#
Every non-2xx body is { "error": { code, message, requestId, ... } }. A syntax error is 400 with position: {line, column}. Codes
in use include bad_request, syntax_error, unauthenticated, not_found, conflict, constraint_violation, node_not_ready,
internal. code values are stable; message is for people.
Differences from the draft#
- Rows in answers are JSON text, not binary frames; integers beyond 2^53 are plain JSON numbers, so a client must parse with an exact parser (the Studio's does).
- The draft's cursor resource,
explain, activity, cluster, backups, settings, users, WebSocket streams, HTTP/2 and TLS are not implemented. - Cursors are consistent only while the data does not change.
Not supported yet#
Binary document frames (application/vnd.rdb.docs), typed query parameters, POST /v1/explain, /v1/cluster, /v1/backups,
/v1/restore, /v1/settings, and the events socket exist only as a draft in the API design document.