Content Items

Document JSON representation

A serialized document typically has a format like the example below. There is the type field, the links containing information about the URL and whether it is internal or external to the current SPA, meta which can contain document information typically only needed for the channel preview in the Experience manager, and the data section containing the actual contents of the document. If the document contains references to other documents, image sets, or assets, they also get serialized flattened, as shown for the image field below.

{
   "type":"document",
   "links":{
      "site":{
         "href":"/news/2015/08/2013-harvest.html",
         "type":"internal"
      }
   },
   "meta":{
      
   },
   "data":{
      "name":"2013-harvest",
      "displayName":"2013 harvest",
      "date":1440571980000,
      "source":"",
      "title":"2013 harvest",
      "introduction":"Lorem ipsum dolor sit amet",
      "author":"Alfred Anonymous",
      "image":{
         "$ref":"/page/ubeff458ee07a40658cad8d96b67d13ec"
      },
      "location":"Rome",
      "content":{
         "value":" <p>Lorem ipsum dolor sit amet</p> "
      },
      "localeString":"en",
      "id":"30092f4e-2ef7-4c72-86a5-8ce895908937"
   }
}

Resource bundle document JSON representation

A resource bundle is a document, so its JSON representation's type attribute is "document" and it exposes the same fields as a document. However, its data section has a specific format that is described below.

The most important attributes of the data section are:

  • name: the name or ID of the resource bundle.
  • keys: an array containing the keys defined in the resource bundle document.
  • messages: an array containing the messages of the default value set. Each value corresponds to the key that is in the same position on the array of keys.
  • valueSets: an array that contains the different value sets. Each value set is composed by its name, and its messages (again, matching the key that is in the same position in the array of keys).

An example of a resource bundle document:

{
   "type":"document",
   "links":{
      "site":{
         "type":"unknown"
      }
   },
   "meta":{
      
   },
   "data":{
      "name":"pagination",
      "displayName":"pagination",
      "stateSummary":"live",
      "transferable":null,
      "retainable":false,
      "holder":null,
      "messages":[
         "next",
         "first",
         "previous",
         "last"
      ],
      "id":"4e0c4599-b2a4-4299-9f2d-d1da63b50884",
      "state":"published",
      "keys":[
         "_next",
         "_first",
         "_previous",
         "_last"
      ],
      "valueSets":[
         {
            "name":"[default]",
            "messages":[
               "next",
               "first",
               "previous",
               "last"
            ]
         },
         {
            "name":"fr",
            "messages":[
               "suivant",
               "première",
               "précédent",
               "dernier"
            ]
         },
         {
            "name":"es",
            "messages":[
               "siguiente",
               "primera",
               "anterior",
               "última"
            ]
         }
      ],
      "localeString":null,
      "contentType":"resourcebundle:resourcebundle"
   }
}

Component content JSON representation

Component content is content embedded in a page-specific component. Its serialized format is very similar to that of a document:

"u1bf91159f6984d889b3fed621b5dbe55":{
    "type":"componentcontent",
    "data":{
        "name":"titleandtext-a1b1",
        "displayName":"titleandtext-a1b1",
        "text":{
            "contentType":"hippostd:html",
            "value":"<p>Lorem ipsum dolor sit amet</p>"
        },
        "title":"Welcome to brX Content",
        "contentType":"brxsaas:titleandtext"
    }
}

Image set JSON representation

Image sets are serialized as type 'imageset' and have all the different image variants serialized including the URL to retrieve them, for example:

"udb02dde500984488a72c2a4fc6d51beb" : {
      "type" : "imageset",
      "links" : { },
      "meta" : { },
      "data" : {
        "name" : "picture.jpeg",
        "displayName" : "picture.jpeg",
        "description" : null,
        "original" : {
          "name" : "hippogallery:original",
          "displayName" : "hippogallery:original",
          "width" : -1,
          "height" : -1,
          "lastModified" : 1236880917884,
          "mimeType" : "image/jpeg",
          "filename" : "picture_original.jpeg",
          "size" : 168981,
          "links" : {
            "site" : {
              "href" : "http://mycontent.bloomreach.io/delivery/resources/unittestcontent/gallery/picture.jpeg",
              "type" : "resource"
            }
          }
        },
        "thumbnail" : {
          "name" : "hippogallery:thumbnail",
          "displayName" : "hippogallery:thumbnail",
          "width" : -1,
          "height" : -1,
          "lastModified" : 1236880917884,
          "mimeType" : "image/jpeg",
          "filename" : "picture_thumbnail.jpeg",
          "size" : 1490,
          "links" : {
            "site" : {
              "href" : "http://mycontent.bloomreach.io/delivery/resources/thumbnail/unittestcontent/gallery/picture.jpeg",
              "type" : "resource"
            }
          }
        },
        "fileName" : null,
        "localeString" : null,
        "id" : "db02dde5-0098-4488-a72c-2a4fc6d51beb"
      }
    }

Pagination JSON representation

Document query components have a search result-like pagination model containing:

  1. A list of actual results for the current page
  2. How many results there are
  3. How many items are on a pages
  4. How many pages there are
  5. What the current page is 

The pagination object gets serialized flattened. Its structure looks as follows and the JSON references the items point to the actual content items which are also serialized flattened in the response:

"uid7": {
      "offset": 0,
      "items": [
        {
          "$ref": "/page/u7467739e33b84a35b6b31659eb90fc67"
        },
        {
          "$ref": "/page/u5b49b58f903d4a91823a1b00fbabbf66"
        },
        {
          "$ref": "/page/uc28bf4536f834377a2ab219e6f71e72c"
        },
        {
          "$ref": "/page/u3046c7d1d14c42e9b13aa96d3c1ba819"
        },
        {
          "$ref": "/page/u9decc66350a340c3820cd6feaf06bab3"
        },
        {
          "$ref": "/page/ud94d39a9badb45419bf65d23e10f0aa3"
        }
      ],
      "total": 58,
      "first": {
        "number": 1,
        "links": {
          "site": {
            "href": "?r22_r1_r4:page=1&r22_r1_r4:limit=3",
            "type": "internal"
          },
          "self": {
            "href": "http://localhost/site/resourceapi?r22_r1_r4:page=1&r22_r1_r4:limit=3",
            "type": "external"
          }
        }
      },
      "previous": null,
      "current": {
        "number": 1,
        "links": {
          "site": {
            "href": "?r22_r1_r4:page=1&r22_r1_r4:limit=3",
            "type": "internal"
          },
          "self": {
            "href": "http://localhost/site/resourceapi?r22_r1_r4:page=1&r22_r1_r4:limit=3",
            "type": "external"
          }
        }
      },
      "next": {
        "number": 2,
        "links": {
          "site": {
            "href": "?r22_r1_r4:page=2&r22_r1_r4:limit=3",
            "type": "internal"
          },
          "self": {
            "href": "http://localhost/site/resourceapi?r22_r1_r4:page=2&r22_r1_r4:limit=3",
            "type": "external"
          }
        }
      },
      "last": {
        "number": 10,
        "links": {
          "site": {
            "href": "?r22_r1_r4:page=10&r22_r1_r4:limit=3",
            "type": "internal"
          },
          "self": {
            "href": "http://localhost/site/resourceapi?r22_r1_r4:page=10&r22_r1_r4:limit=3",
            "type": "external"
          }
        }
      },
      "pages": [
        {
          "number": 1,
          "links": {
            "site": {
              "href": "?r22_r1_r4:page=1&r22_r1_r4:limit=3",
              "type": "internal"
            },
            "self": {
              "href": "http://localhost/site/resourceapi?r22_r1_r4:page=1&r22_r1_r4:limit=3",
              "type": "external"
            }
          }
        },
        {
          "number": 2,
          "links": {
            "site": {
              "href": "?r22_r1_r4:page=2&r22_r1_r4:limit=3",
              "type": "internal"
            },
            "self": {
              "href": "http://localhost/site/resourceapi?r22_r1_r4:page=2&r22_r1_r4:limit=3",
              "type": "external"
            }
          }
        },
        {
          "number": 3,
          "links": {
            "site": {
              "href": "?r22_r1_r4:page=3&r22_r1_r4:limit=3",
              "type": "internal"
            },
            "self": {
              "href": "http://localhost/site/resourceapi?r22_r1_r4:page=3&r22_r1_r4:limit=3",
              "type": "external"
            }
          }
        }
      ],
      "size": 6,
      "enabled": true
    }