Pagination¶
Options¶
All the API requests that return lists of objects support pagination. This is done via two GET parameters:
offset specifies the index at which to start returning objects. It is a zero based index.
limit specifies the maximum number of objects to be returned. If set to 0, all resources will be returned.
Example request:
GET /api/2.0/servers/?limit=0 HTTP/1.1 Content-Type: application/json Authorization: Basic SWYgeW91IGZvdW5kIHRoaXMsIGhhdmUgYSBjb29raWUsIHlvdSBkZXNlcnZlIGl0IDop
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "meta": { "limit": 0, "offset": 0, "total_count": 5 }, "objects": [ { "name": "test_server_4", "owner": { "resource_uri": "/api/2.0/user/80cb30fb-0ea3-43db-b27b-a125752cc0bf/", "uuid": "80cb30fb-0ea3-43db-b27b-a125752cc0bf" }, "resource_uri": "/api/2.0/servers/43b1110a-31c5-41cc-a3e7-0b806076a913/", "runtime": null, "status": "stopped", "uuid": "43b1110a-31c5-41cc-a3e7-0b806076a913" }, { "name": "test_server_2", "owner": { "resource_uri": "/api/2.0/user/80cb30fb-0ea3-43db-b27b-a125752cc0bf/", "uuid": "80cb30fb-0ea3-43db-b27b-a125752cc0bf" }, "resource_uri": "/api/2.0/servers/3be1ebc6-1d03-4c4b-88ff-02557b940d19/", "runtime": null, "status": "stopped", "uuid": "3be1ebc6-1d03-4c4b-88ff-02557b940d19" }, { "name": "test_server_0", "owner": { "resource_uri": "/api/2.0/user/80cb30fb-0ea3-43db-b27b-a125752cc0bf/", "uuid": "80cb30fb-0ea3-43db-b27b-a125752cc0bf" }, "resource_uri": "/api/2.0/servers/b1defe23-e725-474d-acba-e46baa232611/", "runtime": null, "status": "stopped", "uuid": "b1defe23-e725-474d-acba-e46baa232611" }, { "name": "test_server_3", "owner": { "resource_uri": "/api/2.0/user/80cb30fb-0ea3-43db-b27b-a125752cc0bf/", "uuid": "80cb30fb-0ea3-43db-b27b-a125752cc0bf" }, "resource_uri": "/api/2.0/servers/cff0f338-2b84-4846-a028-3ec9e1b86184/", "runtime": null, "status": "stopped", "uuid": "cff0f338-2b84-4846-a028-3ec9e1b86184" }, { "name": "test_server_1", "owner": { "resource_uri": "/api/2.0/user/80cb30fb-0ea3-43db-b27b-a125752cc0bf/", "uuid": "80cb30fb-0ea3-43db-b27b-a125752cc0bf" }, "resource_uri": "/api/2.0/servers/93a04cd5-84cb-41fc-af17-683e3868ee95/", "runtime": null, "status": "stopped", "uuid": "93a04cd5-84cb-41fc-af17-683e3868ee95" } ] }
Meta information¶
The API returns an object with meta information about the request:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "meta": { "limit": 0, "offset": 0, "total_count": 5 } }