Cloud API

Databases

An environment’s database — Overlite, Postgres or Redis — run there for the applications attached to it.

URL base https://cloud.yet.com.br/v1

As descrições dos endpoints estão em inglês.

O objeto

idstring
Its id.
kind"overlite" | "postgres" | "redis"
What it is.
namestring
Its name in its environment.
environment_idstring
Where it runs.
versionstring
What it runs; versions lists the others.
env_varstring
The variable attached applications find it in.
memory_mbnumber
The memory it may use.
stoppedboolean
Kept, not running.

List databases

GET/v1/databases

The environments’, then the applications’.

Requisição
curl https://cloud.yet.com.br/v1/databases \
  -H "Authorization: Bearer $YET_API_KEY"

Get a database

GET/v1/databases/{id}

One database, and how it runs on each runtime.

Requisição
curl https://cloud.yet.com.br/v1/databases/{id} \
  -H "Authorization: Bearer $YET_API_KEY"

Create a database

POST/v1/databases

In an environment, at its newest version.

Quem: Developer everywhere, or admin

Corpo

kindstringobrigatório
overlite, postgres or redis.
namestringobrigatório
Its name.
environment_idstringobrigatório
Where it runs.
Requisição
curl -X POST https://cloud.yet.com.br/v1/databases \
  -H "Authorization: Bearer $YET_API_KEY" \
  -d '{
    "kind": "postgres",
    "name": "orders",
    "environment_id": "en_02K4"
  }'
Resposta · 201
{
  "id": "db_01J9",
  "kind": "postgres",
  "name": "orders",
  "environment_id": "en_02K4",
  "version": "17",
  "env_var": "DATABASE_URL"
}

Change a database

PATCH/v1/databases/{id}

Its name, version, memory, features, hostname, or the studio’s access; stopped or running.

Quem: Developer everywhere, or admin

Corpo

versionstring
One of versions.
memory_mbnumber
The memory it may use.
stoppedboolean
Stops it, or runs it again.
featuresstring[]
pgvector; volatile, evict for Redis.
Requisição
curl -X PATCH https://cloud.yet.com.br/v1/databases/{id} \
  -H "Authorization: Bearer $YET_API_KEY" \
  -d '{
    "memory_mb": 1024,
    "features": [
      "pgvector"
    ]
  }'

Back up now

POST/v1/databases/{id}/backups

A backup, to where its backups go.

Quem: Developer everywhere, or admin

Requisição
curl -X POST https://cloud.yet.com.br/v1/databases/{id}/backups \
  -H "Authorization: Bearer $YET_API_KEY"

Delete a database

DELETE/v1/databases/{id}

It stops; its volume stays on the server.

Quem: Developer everywhere, or admin

Requisição
curl -X DELETE https://cloud.yet.com.br/v1/databases/{id} \
  -H "Authorization: Bearer $YET_API_KEY"
Resposta · 204 Sem conteúdo

List its backups

GET/v1/databases/{id}/backups

How it is copied, and its copies, the latest first.

Requisição
curl https://cloud.yet.com.br/v1/databases/{id}/backups \
  -H "Authorization: Bearer $YET_API_KEY"

Set how it is backed up

PUT/v1/databases/{id}/backups

Every so many hours (0 is never), how many kept, and where: Yet’s bucket, or the company’s.

Quem: Developer everywhere, or admin

Corpo

everynumber
Hours between copies.
keepnumber
How many kept.
target"" | "company"
Where they go.
company{ region, access_key_id, secret_access_key, bucket, prefix }
The company’s bucket, with target: "company".
Requisição
curl -X PUT https://cloud.yet.com.br/v1/databases/{id}/backups \
  -H "Authorization: Bearer $YET_API_KEY" \
  -d '{
    "every": 24,
    "keep": 7
  }'

Download a backup

GET/v1/databases/{id}/backups/{backup}/download

An address to download it from, good for a while.

Requisição
curl https://cloud.yet.com.br/v1/databases/{id}/backups/{backup}/download \
  -H "Authorization: Bearer $YET_API_KEY"
Resposta · 200
{
  "url": "https://…"
}

Run a query

POST/v1/databases/{id}/queries

In one of its stages, by its runtime’s agent: answers at once, pending; ask for it again.

Quem: The database’s studio role

Corpo

statementstringobrigatório
The statement.
environment_idstring
The stage it runs in.
Requisição
curl -X POST https://cloud.yet.com.br/v1/databases/{id}/queries \
  -H "Authorization: Bearer $YET_API_KEY" \
  -d '{
    "statement": "select count(*) from orders"
  }'

Get a query

GET/v1/databases/{id}/queries/{query}

Its status, and its result once done.

Requisição
curl https://cloud.yet.com.br/v1/databases/{id}/queries/{query} \
  -H "Authorization: Bearer $YET_API_KEY"