Storage

Get Storage document

Changed on

Returns the contents of the room’s Storage tree. Corresponds to liveblocks.getStorageDocument.

The default outputted format is called “plain LSON”, which includes information on the Live data structures in the tree. These nodes show up in the output as objects with two properties, for example:

{
  "liveblocksType": "LiveObject",
  "data": ...
}

If you’re not interested in this information, you can use the simpler ?format=json query param, see below.

get/rooms/{roomId}/storage

Request

  • Base URL: https://api.liveblocks.io/v2
  • URL: https://api.liveblocks.io/v2/rooms/{roomId}/storage
  • Auth: none declared

Path parameters

roomIdstring required

ID of the room

Example:my-room-id

Query parameters

format'plain-lson' | 'json'

Use the json format to output a simplified JSON representation of the Storage tree. In that format, each LiveObject and LiveMap becomes a simple JSON object, each LiveList becomes a simple JSON array, and each LiveFile becomes its metadata object. This is a lossy format because information about the original data structures is not retained, but it may be easier to work with.

Example:json

Response

Success. Returns the room’s Storage as JSON.

GetStorageDocumentResponse required

Example response

{
  "liveblocksType": "LiveObject",
  "data": {
    "aLiveObject": {
      "liveblocksType": "LiveObject",
      "data": {
        "a": 1
      }
    },
    "aLiveList": {
      "liveblocksType": "LiveList",
      "data": [
        "a",
        "b"
      ]
    },
    "aLiveMap": {
      "liveblocksType": "LiveMap",
      "data": {
        "a": 1,
        "b": 2
      }
    },
    "aLiveFile": {
      "liveblocksType": "LiveFile",
      "data": {
        "id": "fl_abc123456789012345678",
        "name": "photo.png",
        "size": 12345,
        "mimeType": "image/png"
      }
    }
  }
}

Changes

    • warning

      removed the optional property from the response with the status

    • warning

      removed the optional property from the response with the status

    • info

      api operation id get-rooms-roomId-storage removed and replaced with get-storage-document