REST / OpenAPI

Run the focused REST contract and inspect its OpenAPI description.

Reset this demo?

OpenAPI 3.0.3

WizardGang REST demo 1.0.0

Anonymous CRUD records isolated by a signed visitor-session cookie. The separate /api/openapi.json document describes the bearer-capable machine API.

Servers

Live demo serverhttps://demo.wizardgang.ai

Security

visitorSession

apiKey · cookie · wg_demo_session

A signed, HttpOnly visitor-session cookie is issued on the first request and sent on later requests. Keep a cookie jar when using curl so create, read, update, and delete use the same isolated session.

Records

Cookie-isolated visitor records

GET/api/labs/rest-demo-recordsList records

Return up to 100 records in the current visitor session.

Parameters

No parameters.

Responses

200Records returned.

application/json · object

Example
{
  "results": [
    {
      "id": 1,
      "key": "hello",
      "value": {
        "message": "Hello from a Worker"
      },
      "createdAt": "2026-09-08T12:00:00.000Z",
      "updatedAt": "2026-09-08T12:00:00.000Z"
    }
  ],
  "count": 1
}

Try it out

Execute this operation to inspect the actual response.

POST/api/labs/rest-demo-recordsCreate a record

Create a record under a unique key in the current visitor session.

Parameters

No parameters.

Request body

The key and value for the new record. required

application/json · RecordInput

Example
{
  "key": "hello",
  "value": {
    "message": "Hello from a Worker"
  }
}

Responses

201Record created.

application/json · Record

Example
{
  "id": 1,
  "key": "hello",
  "value": {
    "message": "Hello from a Worker"
  },
  "createdAt": "2026-09-08T12:00:00.000Z",
  "updatedAt": "2026-09-08T12:00:00.000Z"
}
400Request body or key is invalid.

application/json · Error

Example
{
  "error": "invalid_key",
  "detail": "key must be 1–64 letters, numbers, dots, underscores, or hyphens."
}
409The key already exists.

application/json · Error

Example
{
  "error": "record_already_exists",
  "detail": "POST creates a new resource. Use PUT to replace an existing key."
}

Try it out

Execute this operation to inspect the actual response.

GET/api/labs/rest-demo-records/{id}Read a record

Return one record by its key.

Parameters

id path · required
string · The record key. Example: hello

Responses

200Record returned.

application/json · Record

Example
{
  "id": 1,
  "key": "hello",
  "value": {
    "message": "Hello from a Worker"
  },
  "createdAt": "2026-09-08T12:00:00.000Z",
  "updatedAt": "2026-09-08T12:00:00.000Z"
}
404Record does not exist.

application/json · Error

Example
{
  "error": "record_not_found",
  "detail": "No record exists for this key."
}

Try it out

Execute this operation to inspect the actual response.

PUT/api/labs/rest-demo-records/{id}Replace a record

Replace the complete representation at a key, creating the record when it does not exist.

Parameters

id path · required
string · The record key. Example: hello
Request body

The complete replacement representation. required

application/json · RecordReplacement

Example
{
  "value": {
    "message": "Replaced by a Worker"
  }
}

Responses

200Existing record replaced.

application/json · Record

Example
{
  "id": 1,
  "key": "hello",
  "value": {
    "message": "Replaced by a Worker"
  },
  "createdAt": "2026-09-08T12:00:00.000Z",
  "updatedAt": "2026-09-08T12:00:00.000Z"
}
201Record created.

application/json · Record

Example
{
  "id": 1,
  "key": "hello",
  "value": {
    "message": "Replaced by a Worker"
  },
  "createdAt": "2026-09-08T12:00:00.000Z",
  "updatedAt": "2026-09-08T12:00:00.000Z"
}
400Request body or key is invalid.

application/json · Error

Example
{
  "error": "invalid_json"
}

Try it out

Execute this operation to inspect the actual response.

PATCH/api/labs/rest-demo-records/{id}Update a record

Apply the supplied fields without requiring a complete replacement representation.

Parameters

id path · required
string · The record key. Example: hello
Request body

Only the fields that should change. required

application/json · RecordPatch

Example
{
  "value": {
    "message": "Patched by a Worker",
    "priority": "high"
  }
}

Responses

200Existing record updated.

application/json · Record

Example
{
  "id": 1,
  "key": "hello",
  "value": {
    "message": "Patched by a Worker",
    "priority": "high"
  },
  "createdAt": "2026-09-08T12:00:00.000Z",
  "updatedAt": "2026-09-08T12:00:00.000Z"
}
201Record created because the supplied key did not exist.

application/json · Record

Example
{
  "id": 1,
  "key": "hello",
  "value": {
    "message": "Patched by a Worker",
    "priority": "high"
  },
  "createdAt": "2026-09-08T12:00:00.000Z",
  "updatedAt": "2026-09-08T12:00:00.000Z"
}
404Record does not exist and no value was supplied.

application/json · Error

Example
{
  "error": "record_not_found",
  "detail": "No record exists for this key."
}

Try it out

Execute this operation to inspect the actual response.

DELETE/api/labs/rest-demo-records/{id}Delete a record

Delete one record by its key. Repeating the request is safe.

Parameters

id path · required
string · The record key. Example: hello

Responses

204Record deleted. The response has no body.

Try it out

Execute this operation to inspect the actual response.

Schemas

Record A stored visitor-scoped record.
id
integer
required
Database identifier.
Example: 1
key
string
required
Stable resource key.
Example: "hello"
value
object
required
Arbitrary JSON-compatible record value.
Example: { "message": "Hello from a Worker" }
createdAt
string (date-time)
required
UTC creation timestamp.
Example: "2026-09-08T12:00:00.000Z"
updatedAt
string (date-time)
required
UTC timestamp of the latest change.
Example: "2026-09-08T12:02:00.000Z"
RecordInput Representation used to create a record.
key
string
required
Unique key containing 1–64 letters, numbers, dots, underscores, or hyphens.
Example: "hello"
value
object
required
Arbitrary JSON-compatible record value.
Example: { "message": "Hello from a Worker" }
RecordReplacement Complete mutable representation used by PUT.
value
object
required
The complete replacement value.
Example: { "message": "Replaced by a Worker" }
RecordPatch Partial mutable representation used by PATCH.
value
object
optional
A replacement value supplied only when it should change.
Example: { "message": "Patched by a Worker", "priority": "high" }
Error A machine-readable API error.
error
string
required
Stable error code.
Example: "record_not_found"
detail
string
optional
Optional human-readable detail.
Example: "No record exists for this key."