Skip to content

Connect JSON API

Connect exposes HTTP endpoints that accept JSON for simple local testing.

Start celld:

Terminal window
nix develop -c go run ./cmd/celld --state /tmp/devcell.db

Inspect the host:

Terminal window
curl \
-H 'Content-Type: application/json' \
-d '{}' \
http://127.0.0.1:8080/devcell.v1.HostService/InspectHost

Negotiate API support and inspect pairing state:

Terminal window
curl \
-H 'Content-Type: application/json' \
-d '{"clientName":"devcell-cli","supportedApiVersions":["devcell.v1"]}' \
http://127.0.0.1:8080/devcell.v1.HostService/NegotiateAPI
curl \
-H 'Content-Type: application/json' \
-d '{}' \
http://127.0.0.1:8080/devcell.v1.HostService/GetPairingStatus

Local pairing:

Terminal window
curl \
-H 'Content-Type: application/json' \
-d '{"clientName":"DevCell Swift"}' \
http://127.0.0.1:8080/devcell.v1.HostService/StartPairing
curl \
-H 'Content-Type: application/json' \
-d '{"pairingId":"pairing...","pairingCode":"CODE...","clientName":"DevCell Swift"}' \
http://127.0.0.1:8080/devcell.v1.HostService/CompletePairing

Create a cell:

Terminal window
curl \
-H 'Content-Type: application/json' \
-d '{"name":"open-seat","repository":"github.com/example/open-seat","branch":"main","resources":{"vcpu":2,"memoryBytes":"4294967296","workspaceBytes":"21474836480"}}' \
http://127.0.0.1:8080/devcell.v1.CellService/CreateCell

List cells:

Terminal window
curl \
-H 'Content-Type: application/json' \
-d '{}' \
http://127.0.0.1:8080/devcell.v1.CellService/ListCells

Start, stop, and destroy a cell:

Terminal window
curl \
-H 'Content-Type: application/json' \
-d '{"cellId":"cell_...","idempotencyKey":"start-once"}' \
http://127.0.0.1:8080/devcell.v1.CellService/StartCell
curl \
-H 'Content-Type: application/json' \
-d '{"cellId":"cell_...","idempotencyKey":"stop-once"}' \
http://127.0.0.1:8080/devcell.v1.CellService/StopCell
curl \
-H 'Content-Type: application/json' \
-d '{"cellId":"cell_..."}' \
http://127.0.0.1:8080/devcell.v1.CellService/DestroyCell

Get an operation:

Terminal window
curl \
-H 'Content-Type: application/json' \
-d '{"operationId":"op_..."}' \
http://127.0.0.1:8080/devcell.v1.OperationService/GetOperation

Run cell-agent on a different port:

Terminal window
nix develop -c go run ./cmd/cell-agent --listen 127.0.0.1:9090 --cell-id cell_localdev

Inspect guest status:

Terminal window
curl \
-H 'Content-Type: application/json' \
-d '{}' \
http://127.0.0.1:9090/devcell.v1.GuestService/GetGuestStatus

Initialize a workspace:

Terminal window
curl \
-H 'Content-Type: application/json' \
-d '{"repository":"github.com/example/open-seat","branch":"main","workspacePath":"/workspaces/open-seat","devcontainerPath":"/workspaces/open-seat/.devcontainer/devcontainer.json","executionPlanJson":"{\"runtime\":\"moby\"}"}' \
http://127.0.0.1:9090/devcell.v1.GuestService/InitializeWorkspace

Discover services and ports:

Terminal window
curl \
-H 'Content-Type: application/json' \
-d '{}' \
http://127.0.0.1:9090/devcell.v1.GuestService/ListGuestServices
curl \
-H 'Content-Type: application/json' \
-d '{}' \
http://127.0.0.1:9090/devcell.v1.GuestService/ListGuestPorts

Prepare and resume a snapshot:

Terminal window
curl \
-H 'Content-Type: application/json' \
-d '{"snapshotId":"snapshot_localdev"}' \
http://127.0.0.1:9090/devcell.v1.GuestService/PrepareSnapshot
curl \
-H 'Content-Type: application/json' \
-d '{"snapshotId":"snapshot_localdev"}' \
http://127.0.0.1:9090/devcell.v1.GuestService/ResumeSnapshot