PKU harness
CloudAPI reference

Store

Key-value store namespaced by `(deviceId, plugin)` taken from the token, never from the path. Values are envelopes when the plugin declares `e2e`.

List keys

GET
/v1/store

Keys of the calling (device, plugin) namespace, optionally filtered by prefix. Values are not included.

Authorization

pluginToken
headerAuthorizationBearer <token>

Token from POST /v1/auth/token (10 minutes, one device + one plugin + services). Channel owner endpoints require the token of the device and plugin that opened the channel.

Query Parameters

prefix?string

Only keys starting with this string.

Response Body

Matching keys.

application/json
  1. response
items*array<>
cursor?string

Present when there are more keys.

Example Request
curl -X GET 'https://cloud.example.org/v1/store'
Example Response
{  "items": [    {      "key": "string",      "version": 1,      "updatedAt": 0    }  ],  "cursor": "string"}

Read a value

GET
/v1/store/{key}

Authorization

pluginToken
headerAuthorizationBearer <token>

Token from POST /v1/auth/token (10 minutes, one device + one plugin + services). Channel owner endpoints require the token of the device and plugin that opened the channel.

Path Parameters

key*string

Path-like key (/ allowed, each segment URL-encoded), no . or .. segments.

Match^[A-Za-z0-9._:/-]{1,256}$

Response Body

The value with its version.

application/json
  1. response
key*StoreKey

Path-like key; no . or .. segments.

Match^[A-Za-z0-9._:/-]{1,256}$
value?unknown

Any JSON value; an Envelope when the plugin declares e2e.

version*integer
Range1 <= value
updatedAt*Ms

Unix time in milliseconds.

Range0 <= value
expiresAt?Ms

Unix time in milliseconds.

Range0 <= value
Example Request
curl -X GET 'https://cloud.example.org/v1/store/string'
Example Response
{  "key": "string",  "value": null,  "version": 1,  "updatedAt": 0,  "expiresAt": 0}

Delete a value

DELETE
/v1/store/{key}

Authorization

pluginToken
headerAuthorizationBearer <token>

Token from POST /v1/auth/token (10 minutes, one device + one plugin + services). Channel owner endpoints require the token of the device and plugin that opened the channel.

Path Parameters

key*string

Path-like key (/ allowed, each segment URL-encoded), no . or .. segments.

Match^[A-Za-z0-9._:/-]{1,256}$

Response Body

Deleted.

application/json
  1. response
ok*boolean
Example Request
curl -X DELETE 'https://cloud.example.org/v1/store/string'
Example Response
{  "ok": true}

Write a value

PUT
/v1/store/{key}

Creates or replaces a value. Optimistic concurrency with If-Match: <version>: the write fails with 409 conflict unless the stored version matches; If-Match: 0 means the key must not exist yet. Default quotas: 1 MB and 1,000 keys per plugin per device, 64 KB per value (limits.store in GET /v1/meta).

Authorization

pluginToken
headerAuthorizationBearer <token>

Token from POST /v1/auth/token (10 minutes, one device + one plugin + services). Channel owner endpoints require the token of the device and plugin that opened the channel.

Path Parameters

key*string

Path-like key (/ allowed, each segment URL-encoded), no . or .. segments.

Match^[A-Za-z0-9._:/-]{1,256}$

Header Parameters

If-Match?string

Expected current version; 0 = the key must not exist.

Match^[0-9]+$

Request Body

application/json
  1. body
value?unknown

Any JSON value; an Envelope when the plugin declares e2e.

ttlS?integer

Expire the value after this many seconds.

Range1 <= value

Response Body

The new version (also sent as the ETag header).

application/json
  1. response
version*integer
Range1 <= value
Example Request
curl -X PUT 'https://cloud.example.org/v1/store/string' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "version": 1}