API
Databases
Create, read and erase the databases of your organization, and poll the long operations that back them.
On this page
The examples use the two shell variables from Authentication:
export FENVIX_API=https://api.fenvix.dev/v1/public
export FENVIX_KEY="$(read_from_your_secret_store)" # never written in a commandList databases, newest first#
GET /databases
Works with an admin or a read_only key.
curl -sS "$FENVIX_API/databases" \
-H "Authorization: Bearer $FENVIX_KEY"Parameters#
| Name | In | Required | Type | Notes |
|---|---|---|---|---|
cursor |
query | no | string | The nextCursor of the previous page. |
limit |
query | no | integer | Default 20. |
Answers#
| Status | Body | Meaning |
|---|---|---|
200 |
object |
A page of databases. |
400 |
Error |
Bad cursor or limit. |
401 |
Error |
No key, or the key is not valid, has expired or has been revoked. |
429 |
Error |
Too many requests. Wait for the number of seconds in Retry-After. |
Create a database#
POST /databases
Needs an admin key. Accepts Idempotency-Key.
Answers 201 with the database and its initial user. The initial user's password is in this answer only (null in a replay or a poll).
curl -sS -X POST "$FENVIX_API/databases" \
-H "Authorization: Bearer $FENVIX_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"orders","region":"eu-central-1"}'Parameters#
| Name | In | Required | Type | Notes |
|---|---|---|---|---|
Idempotency-Key |
header | no | string | Repeat a request safely for 24 hours. See the Idempotency section. |
Request body#
| Field | Required | Type | Notes |
|---|---|---|---|
name |
yes | string | 3 to 48 lowercase letters, numbers or dashes. Pattern ^[a-z0-9][a-z0-9-]{1,46}[a-z0-9]$. |
region |
yes | string (eu-central-1) |
— |
tags |
no | array | — |
appUser |
no | string | Name of the initial database user. Default app. |
Answers#
| Status | Body | Meaning |
|---|---|---|
201 |
CreatedDatabase |
Created. |
202 |
object |
Still running. Poll the URL in Location (GET /operations/{id}). |
400 |
Error |
The request is not valid; field names the part that is not. |
401 |
Error |
No key, or the key is not valid, has expired or has been revoked. |
403 |
Error |
The key is read only. |
409 |
Error |
Conflict: the name is taken, the database is busy, or the Idempotency-Key was used for another request. |
429 |
Error |
Too many requests. Wait for the number of seconds in Retry-After. |
Get a database#
GET /databases/{id}
Works with an admin or a read_only key.
curl -sS "$FENVIX_API/databases/$DATABASE_ID" \
-H "Authorization: Bearer $FENVIX_KEY"Parameters#
| Name | In | Required | Type | Notes |
|---|---|---|---|---|
id |
path | yes | string | — |
Answers#
| Status | Body | Meaning |
|---|---|---|
200 |
Database |
The database. Its connection string never holds a password. |
401 |
Error |
No key, or the key is not valid, has expired or has been revoked. |
404 |
Error |
No such database in this organization. |
429 |
Error |
Too many requests. Wait for the number of seconds in Retry-After. |
Delete (erase) a database#
DELETE /databases/{id}
Needs an admin key. Accepts Idempotency-Key.
curl -sS -X DELETE "$FENVIX_API/databases/$DATABASE_ID" \
-H "Authorization: Bearer $FENVIX_KEY"Parameters#
| Name | In | Required | Type | Notes |
|---|---|---|---|---|
id |
path | yes | string | — |
Idempotency-Key |
header | no | string | Repeat a request safely for 24 hours. See the Idempotency section. |
Answers#
| Status | Body | Meaning |
|---|---|---|
200 |
object |
Erased. |
202 |
object |
Still running. Poll the URL in Location (GET /operations/{id}). |
400 |
Error |
The request is not valid; field names the part that is not. |
401 |
Error |
No key, or the key is not valid, has expired or has been revoked. |
403 |
Error |
The key is read only. |
404 |
Error |
No such database in this organization. |
409 |
Error |
Conflict: the name is taken, the database is busy, or the Idempotency-Key was used for another request. |
429 |
Error |
Too many requests. Wait for the number of seconds in Retry-After. |
Poll a long operation#
GET /operations/{id}
Works with an admin or a read_only key.
curl -sS "$FENVIX_API/operations/$OPERATION_ID" \
-H "Authorization: Bearer $FENVIX_KEY"Parameters#
| Name | In | Required | Type | Notes |
|---|---|---|---|---|
id |
path | yes | string | — |
Answers#
| Status | Body | Meaning |
|---|---|---|
200 |
OperationWithResult |
The operation. |
401 |
Error |
No key, or the key is not valid, has expired or has been revoked. |
404 |
Error |
No such operation. |
429 |
Error |
Too many requests. Wait for the number of seconds in Retry-After. |