v0.11.0

HTTP API

Last updated


This page lists the API server endpoints, request formats, and table schema.

Endpoints


The API server listens on :8080 and responds with the string ok or {"data": [...]} on success; JSON binding errors return 400 and database errors return 500, both with the error message as a string.
MethodPathBodyDescription
GET/api/health—Health check; returns ok
GET/api/pod/list—List deployments with dismiss = 0
POST/api/pod/upsertPodInsert or update a deployment by uid and reset dismiss = 0
POST/api/pod/update/:uidPod (uses only status, dismiss)Update the given deployment
POST/api/pod/record/insertRecord (uses uid, content, hostname, ip)Insert an operation record by uid

Unregistered paths fall through to NoRoute, which holds the request open without ever responding.

Example


  1. curl -X POST localhost:8080/api/pod/upsert \
  2. -d '{"uid":"t1","pod_id":"p","pod_name":"n","local_dir":"/a","remote_dir":"/b","status":"starting","replicas":1}'
  3. curl localhost:8080/api/pod/list

Pod Fields


FieldTypeDescription
uidstringmd5("<MAC>@<local-absolute-path>") or the -u value
pod_idstringPodman Pod ID; the remote folder name when the lookup fails
pod_namestringPodman Pod name; the remote folder name when the lookup fails
local_dirstringLocal project absolute path
remote_dirstring/home/podrun/<folder-name>_<first-8-hash-chars>
filestringCompose file passed via -f
targetstringValue of --type; [Unfinished] k3s is recorded only
statusstringstarting after up; empty after removePod()
hostnamestringHostname of the machine running the CLI
ipstringFirst non-loopback IPv4 of the machine running the CLI
replicasintAlways 1
created_at / updated_attimeWritten by the database
dismissint0 active, 1 removed

pod_id is stored in the table's pod_uid column.

Tables


TablePurposeColumns
podsOne row per deployment; uid and pod_uid are uniqueuid, pod_uid, pod_name, local_dir, remote_dir, file, target, status, hostname, ip, replicas, created_at, updated_at, dismiss
recordsOperation log; pod_id references pods.id (cascade on delete)pod_id, content, hostname, ip
domains[Unfinished] Reserved for the domain commandpod_id, container_name, domain, created_at, updated_at, dismiss
中文