Connect JSON API
Connect exposes HTTP endpoints that accept JSON for simple local testing.
Start celld:
nix develop -c go run ./cmd/celld --state /tmp/devcell.dbInspect the host:
curl \ -H 'Content-Type: application/json' \ -d '{}' \ http://127.0.0.1:8080/devcell.v1.HostService/InspectHostNegotiate API support and inspect pairing state:
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/GetPairingStatusLocal pairing:
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/CompletePairingCreate a cell:
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/CreateCellList cells:
curl \ -H 'Content-Type: application/json' \ -d '{}' \ http://127.0.0.1:8080/devcell.v1.CellService/ListCellsStart, stop, and destroy a cell:
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/DestroyCellGet an operation:
curl \ -H 'Content-Type: application/json' \ -d '{"operationId":"op_..."}' \ http://127.0.0.1:8080/devcell.v1.OperationService/GetOperationGuestService development endpoint
Section titled “GuestService development endpoint”Run cell-agent on a different port:
nix develop -c go run ./cmd/cell-agent --listen 127.0.0.1:9090 --cell-id cell_localdevInspect guest status:
curl \ -H 'Content-Type: application/json' \ -d '{}' \ http://127.0.0.1:9090/devcell.v1.GuestService/GetGuestStatusInitialize a workspace:
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/InitializeWorkspaceDiscover services and ports:
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/ListGuestPortsPrepare and resume a snapshot:
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