// Document 1: fetch first page and extract cursor
localhost:50051
api.ItemService/ListItems
{
"category": "electronics",
"limit": 10
}
{
"items": [
{ "id": "item-1", "name": "Laptop" },
{ "id": "item-2", "name": "Phone" }
],
"cursor": "eyJvZmZzZXQiOjEwfQ==",
"has_more": true,
"total": 42
}
next_cursor = .cursor
item_count = .items | length
has_more = .has_more
$item_count == 2
$has_more == true
// Document 2: fetch second page using cursor
api.ItemService/ListItems
{
"category": "electronics",
"limit": 10,
"cursor": "{{next_cursor}}"
}
{
"items": [
{ "id": "item-3", "name": "Tablet" },
{ "id": "item-4", "name": "Monitor" }
],
"cursor": "eyJvZmZzZXQiOjIwfQ==",
"has_more": true,
"total": 42
}
next_cursor = .cursor
page2_count = .items | length
$page2_count == 2
$next_cursor != "{{next_cursor}}"
// Document 3: fetch remaining items (last page)
api.ItemService/ListItems
{
"category": "electronics",
"limit": 10,
"cursor": "{{next_cursor}}"
}
{
"items": [],
"cursor": "",
"has_more": false,
"total": 42
}
@len(.items) == 0
.has_more == false