ChatKitty
Search…
Pagination
Traverse through ChatKitty collections efficiently with pagination.
ChatKitty paginates all collection resources. Requesting a resource collection returns the first page of the collection optionally with HAL hypermedia links to subsequent pages if more pages are available.
Traverse the page links to iterate through a collection.
1
{
2
"_embedded": {
3
"users": [
4
{
5
"id": 1,
6
"name": "[email protected]ty.com",
7
"displayName": "Jane Doe",
8
"_links": {
9
"self": {
10
"href": "https://api.chatkitty.com/v1/applications/1/users/1"
11
},
12
"channels": {
13
"href": "https://api.chatkitty.com/v1/applications/1/users/1/channels"
14
},
15
"application": {
16
"href": "https://api.chatkitty.com/v1/applications/1"
17
}
18
}
19
},
20
{
21
"id": 2,
22
"name": "[email protected]",
23
"displayName": "John Doe",
24
"_links": {
25
"self": {
26
"href": "https://api.chatkitty.com/v1/applications/1/users/2"
27
},
28
"channels": {
29
"href": "https://api.chatkitty.com/v1/applications/1/users/2/channels"
30
},
31
"application": {
32
"href": "https://api.chatkitty.com/v1/applications/1"
33
}
34
}
35
}, // Other items in this slice ...
36
]
37
},
38
"_links": {
39
"first": {
40
"href": "https://api.chatkitty.com/v1/applications/1/users?page=0&size=25"
41
},
42
"prev": {
43
"href": "https://api.chatkitty.com/v1/applications/1/users?page=0&size=25"
44
},
45
"self": {
46
"href": "https://api.chatkitty.com/v1/applications/1/users?page=1&size=25"
47
},
48
"next": {
49
"href": "https://api.chatkitty.com/v1/applications/1/users?page=2&size=25"
50
},
51
"last": {
52
"href": "https://api.chatkitty.com/v1/applications/1/users?page=2&size=25"
53
}
54
},
55
"page": {
56
"size": 25,
57
"totalElements": 50,
58
"totalPages": 2,
59
"number": 0
60
}
61
}
Copied!

Properties

Embedded properties

A page resource embeds a slice of a resource collection in a JSON array property with the same name as the resource collection. For example, with a collection of users resources, the resource collection name would be users, and the page would include a JSON array in its _embedded property named users, as per the HAL specification.
1
{
2
"_embedded": {
3
"users": [
4
{
5
"id": 1,
6
"name": "[email protected]",
7
"displayName": "Jane Doe",
8
"_links": {
9
"self": {
10
"href": "https://api.chatkitty.com/v1/applications/1/users/1"
11
},
12
"channels": {
13
"href": "https://api.chatkitty.com/v1/applications/1/users/1/channels"
14
},
15
"application": {
16
"href": "https://api.chatkitty.com/v1/applications/1"
17
}
18
}
19
},
20
{
21
"id": 2,
22
"name": "[email protected]",
23
"displayName": "John Doe",
24
"_links": {
25
"self": {
26
"href": "https://api.chatkitty.com/v1/applications/1/users/2"
27
},
28
"channels": {
29
"href": "https://api.chatkitty.com/v1/applications/1/users/2/channels"
30
},
31
"application": {
32
"href": "https://api.chatkitty.com/v1/applications/1"
33
}
34
}
35
}, // Other items in this slice ...
36
]
37
}, // Page links and metadata
38
}
Copied!
Link
Methods
Description
self
GET
Self link to this page.
first
GET
Optional: Link to the first page of this collection. Present if known.
prev
GET
Optional: Link to the previous page of this collection. Present if there are more items before the first item in this page.
next
GET
Optional: Link to the next page of this collection. Present if there are more items after the last item in this page.
last
GET
Optional: Link to the last page of this collection. Present if known.
1
{
2
// ... Embedded properties,
3
"_links": {
4
"first": {
5
"href": "https://api.chatkitty.com/v1/applications/1/users?page=0&size=25"
6
},
7
"prev": {
8
"href": "https://api.chatkitty.com/v1/applications/1/users?page=0&size=25"
9
},
10
"self": {
11
"href": "https://api.chatkitty.com/v1/applications/1/users?page=1&size=25"
12
},
13
"next": {
14
"href": "https://api.chatkitty.com/v1/applications/1/users?page=2&size=25"
15
},
16
"last": {
17
"href": "https://api.chatkitty.com/v1/applications/1/users?page=2&size=25"
18
}
19
}, // Page metadata ...
20
}
Copied!

Page Metadata

Metadata about a page containing its size, total number of elements in the collection, the total number of pages in the collection, and the page number.
Name
Type
Description
size
Int
The number of elements in this page.
number
Int
Optional: The zero-based index of this page. Present if known.
totalElements
Long
Optional: The total number of elements in the collection. Present if known.
totalPages
Int
Optional: The total number of pages in the collection. Present if known.
1
{
2
// ... Embedded properties and page links,
3
"page": {
4
"size": 25,
5
"totalElements": 50,
6
"totalPages": 2,
7
"number": 0
8
}
9
}
Copied!
Last modified 12d ago