HTTP API

The HTTP server exposes a JSON REST API for key-value operations.

Endpoints

GET /v1/keys/{key}

Retrieve a value by key.

curl http://localhost:3456/v1/keys/mykey

Response 200:

{"key": "mykey", "value": "hello"}

Response 404:

{"error": "key not found"}

PUT /v1/keys/{key}

Store a value.

curl -X PUT http://localhost:3456/v1/keys/mykey \
  -H "Content-Type: application/json" \
  -d '{"value": "hello"}'

Response 204 (no content).

DELETE /v1/keys/{key}

Delete a key.

curl -X DELETE http://localhost:3456/v1/keys/mykey

Response 204 (no content).

Response 404:

{"error": "key not found"}

GET /healthz

Health check endpoint.

curl http://localhost:3456/healthz

Response 200 (no content).

Error Responses

All errors return a JSON body:

{"error": "description of the error"}
StatusDescription
400Key is missing or request body is invalid
404Key not found
405Method not allowed
500Internal server error