SmallPlate

JSON API

Store and retrieve JSON objects natively without manual serialization

JSON endpoints make it easy to store structured JSON without manually serializing and deserializing at the client layer.

Endpoints

MethodEndpointDescription
GET/{plateId}/json/{key}Get a JSON value
POST/{plateId}/json/{key}Store a JSON value
DELETE/{plateId}/json/{key}Delete a JSON value

Store JSON

const plateId = "[id]";
const apiKey = "your-api-key";
const baseUrl = "[base-url]";

const response = await fetch(`${baseUrl}/${plateId}/json/user:1`, {
  method: "POST",
  headers: {
    "Authorization": apiKey,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    value: {
      name: "Ada",
      age: 30,
      active: true
    },
    ttl_ms: 3600000
  })
});

const data = await response.json();
console.log(data);

Read JSON

const plateId = "[id]";
const apiKey = "your-api-key";
const baseUrl = "[base-url]";

const response = await fetch(`${baseUrl}/${plateId}/json/user:1`, {
  method: "GET",
  headers: {
    "Authorization": apiKey
  }
});

const data = await response.json();
console.log(data);

Delete JSON

const plateId = "[id]";
const apiKey = "your-api-key";
const baseUrl = "[base-url]";

const response = await fetch(`${baseUrl}/${plateId}/json/user:1`, {
  method: "DELETE",
  headers: {
    "Authorization": apiKey
  }
});

const data = await response.json();
console.log(data);

Notes

  • Values are stored as JSON-encoded strings internally.
  • GET returns the decoded JSON structure inside the standard envelope.

On this page