Paging

This section describes how to specify the number of objects to return from an endpoint, and a specific group of objects to return.

Controlling the Number of Results

To limit the number of results returned, append the URL parameter limit=N, where N is the maximum number of objects, defaulting to 20.

Example Request

The following example shows a request to return the first two objects:

$ curl -G "https://octave-api.sierrawireless.io/v5.0/my_company/event/<stream_id>" \
>   -H "X-Auth-Token: 2R5xwhmlmb9r6z90XCUYqOu1ScJJuPMr" \
>   --data-urlencode 'limit=2'

Example Response

{
  "head": {
    "status": 200,
    "ok": true,
    "messages": [],
    "errors": [],
    "references": {}
  },
  "body": [{
    "id": "d585827455caf784b9ef99ba3",
    "streamId": "f53b1d1600cf27b75148de02e",
    "creationDate": 1482172229772,
    "path": "/my_company/lightSensor",
    "version": 0,
    "elems": {
    "measure": 2
    }
  }, {
    "id": "d585827455caf784b9ef99b9f",
    "streamId": "f53b1d1600cf27b75148de02e",
    "creationDate": 1482172229516,
    "path": "/my_company/lightSensor",
    "version": 0,
    "elems": {
      "measure": 1
    }
  }]
}

Skipping Results

To specify the starting index of the results to return, append the URL parameter start=N, where N is the starting index, defaulting to 0. You can also optionally include the limit parameter to specify the number of objects to return.

Example Request

The following example shows a request for objects 21 through 40:

$ curl -G "https://octave-api.sierrawireless.io/v5.0/my_company/event/<stream_id>" \
>   -H "X-Auth-Token: 2R5xwhmlmb9r6z90XCUYqOu1ScJJuPMr" \
>   --data-urlencode 'start=12' \
>   --data-urlencode 'limit=20'

Example Response

The following shows a partial response for the request:

{
  "head": {
    "status": 200,
    "ok": true,
    "messages": [],
    "errors": [],
    "references": {}
  },
  "body": [{
    "id": "d585827455caf784b9ef99ba3",
    "streamId": "f53b1d1600cf27b75148de02e",
    "creationDate": 1482172229772,
    "path": "/my_company/lightSensor",
    "version": 0,
    "elems": {
    "measure": 2
    }
  }, {
    "id": "d585827455caf784b9ef99b9f",
    "streamId": "f53b1d1600cf27b75148de02e",
    "creationDate": 1482172229516,
    "path": "/my_company/lightSensor",
    "version": 0,
    "elems": {
      "measure": 1
    }
  }
 ...
 ]
}