Data Store API
Overview
The Data Store API provides generic JSON key/value storage for short-lived or simple structured data.
Base URL
https://<manager-host>/api/v1/datastore
Endpoints
GET /api/v1/datastore
List all known keys.
Query Parameters:
show_hidden- Boolean (defaultfalse). Whentrue, includes internal keys starting with_.
Success Response (200):
["user:123", "config:settings", "session:abc"]
Hidden Keys: Keys starting with _ are reserved for internal use (e.g., subnet service). Writing to hidden keys via the datastore API returns 400 Bad Request.
GET /api/v1/datastore/{key}
Retrieve the JSON value for a specific key.
Success Response (200): The stored JSON value
Errors:
404- Key does not exist500- Backend failure
Example:
curl -s "https://cdn-manager/api/v1/datastore/user:123"
POST /api/v1/datastore/{key}
Create a new JSON value at the specified key. Fails if the key already exists.
Query Parameters:
ttl- Expiry time as humantime string (e.g.,60s,1h)
Request:
{
"id": 123,
"name": "alice"
}
Success: 201 Created
Errors:
409 Conflict- Key already exists500- Backend failure
Example:
curl -s -X POST "https://cdn-manager/api/v1/datastore/user:123?ttl=1h" \
-H "Content-Type: application/json" \
-d '{"id":123,"name":"alice"}'
PUT /api/v1/datastore/{key}
Update or replace the JSON value at an existing key.
Query Parameters:
ttl- Expiry time as humantime string
Success: 200 OK
Errors:
404- Key does not exist500- Backend failure
Example:
curl -s -X PUT "https://cdn-manager/api/v1/datastore/user:123" \
-H "Content-Type: application/json" \
-d '{"id":123,"name":"alice-updated"}'
DELETE /api/v1/datastore/{key}
Delete the value at the specified key. Idempotent operation.
Success: 204 No Content
Errors: 500 - Backend failure
Example:
curl -s -X DELETE "https://cdn-manager/api/v1/datastore/user:123"
Next Steps
- Subnets API - CIDR-to-value mappings
- Routing API - GeoIP lookups
- OpenAPI Specification - Complete API specification