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_3",
                "owner": {
                    "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
                    "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
                },
                "resource_uri": "/api/2.0/servers/3ca429cc-b4f4-42a8-aaa8-3a6df700af06/",
                "runtime": null,
                "status": "stopped",
                "uuid": "3ca429cc-b4f4-42a8-aaa8-3a6df700af06"
            },
            {
                "name": "test_server_0",
                "owner": {
                    "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
                    "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
                },
                "resource_uri": "/api/2.0/servers/f50b672f-a963-4b8a-bf05-809b3ffd9a9f/",
                "runtime": null,
                "status": "stopped",
                "uuid": "f50b672f-a963-4b8a-bf05-809b3ffd9a9f"
            },
            {
                "name": "test_server_1",
                "owner": {
                    "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
                    "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
                },
                "resource_uri": "/api/2.0/servers/5d5f22ea-68ae-4b83-9b19-7d7cdd2eb888/",
                "runtime": null,
                "status": "stopped",
                "uuid": "5d5f22ea-68ae-4b83-9b19-7d7cdd2eb888"
            },
            {
                "name": "test_server_4",
                "owner": {
                    "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
                    "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
                },
                "resource_uri": "/api/2.0/servers/8d483469-faeb-4408-899b-a10df6bf3587/",
                "runtime": null,
                "status": "stopped",
                "uuid": "8d483469-faeb-4408-899b-a10df6bf3587"
            },
            {
                "name": "test_server_2",
                "owner": {
                    "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
                    "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
                },
                "resource_uri": "/api/2.0/servers/514a790d-9798-4476-93e9-5cecb4b1c6a3/",
                "runtime": null,
                "status": "stopped",
                "uuid": "514a790d-9798-4476-93e9-5cecb4b1c6a3"
            }
        ]
    }
    

Meta information

The API returns an object with meta information about the request:

{
    "meta": {
        "limit": 0,
        "offset": 0,
        "total_count": 5
    }
}