Batching

Representations of collection-like resources are batched / paginated if the size of the resulset exceeds the batching size:

{
  "@id": "http://.../folder/search",
  "batching": {
    "@id": "http://.../folder/search?b_size=10&b_start=20",
    "first": "http://.../plone/folder/search?b_size=10&b_start=0",
    "last": "http://.../plone/folder/search?b_size=10&b_start=170",
    "prev": "http://.../plone/folder/search?b_size=10&b_start=10",
    "next": "http://.../plone/folder/search?b_size=10&b_start=30"
  },
  "items": [
    "..."
  ],
  "items_total": 175,
}

If the entire resulset fits into a single batch page (as determined by b_size), the top-level batching links will be omitted.

Top-level attributes

Attribute Description
@id Canonical base URL for the resource, without any batching parameters
items Current batch of items / members of the collection-like resource
items_total Total number of items
batching Batching related navigation links (see below)

Parameters

Batching can be controlled with two query string parameters. In order to address a specific batch page, the b_start parameter can be used to request a specific batch page, containing b_size items starting from b_start.

Parameter Description
b_size Batch size (default is 25)
b_start First item of the batch

Full example of a batched request and response:

http

GET /plone/@types HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0

curl

curl -i http://nohost/plone/@types -H "Accept: application/json" --user admin:secret

httpie

http -j http://nohost/plone/@types -a admin:secret

python-requests

requests.get('http://nohost/plone/@types', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "@id": "http://localhost:55001/plone/@types/Collection", 
    "addable": true, 
    "title": "Collection"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/Discussion Item", 
    "addable": false, 
    "title": "Discussion Item"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/DXTestDocument", 
    "addable": true, 
    "title": "DXTestDocument"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/Event", 
    "addable": true, 
    "title": "Event"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/File", 
    "addable": true, 
    "title": "File"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/Folder", 
    "addable": true, 
    "title": "Folder"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/Image", 
    "addable": true, 
    "title": "Image"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/Link", 
    "addable": true, 
    "title": "Link"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/News Item", 
    "addable": true, 
    "title": "News Item"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/Document", 
    "addable": true, 
    "title": "Document"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/ATTestDocument", 
    "addable": true, 
    "title": "ATTestDocument"
  }, 
  {
    "@id": "http://localhost:55001/plone/@types/ATTestFolder", 
    "addable": true, 
    "title": "ATTestFolder"
  }
]