Pagination

Page, cursor, empty, and end-of-list responses. Load a template into the create form, then adjust the response before creating an endpoint.

200application/jsonGET

Page with next link

Test list screens that need a next cursor.

Use template
View payload and cURL

Headers

none

Body

{
  "items": [
    {
      "id": "evt_001",
      "label": "Created"
    },
    {
      "id": "evt_002",
      "label": "Processed"
    }
  ],
  "page": {
    "limit": 2,
    "next_cursor": "evt_002"
  }
}

Create with cURL

curl -i 'https://stubpoint.dev/api/endpoints' -H 'Content-Type: application/json' -d '{
  "body": "{\n  \"items\": [\n    {\"id\": \"evt_001\", \"label\": \"Created\"},\n    {\"id\": \"evt_002\", \"label\": \"Processed\"}\n  ],\n  \"page\": {\"limit\": 2, \"next_cursor\": \"evt_002\"}\n}",
  "content_type": "application/json",
  "headers": null,
  "methods": [
    "GET"
  ],
  "status": 200
}'
200application/jsonGET

Empty page

Check the empty-list state after filters or first load.

Use template
View payload and cURL

Headers

none

Body

{
  "items": [],
  "page": {
    "limit": 20,
    "next_cursor": null
  }
}

Create with cURL

curl -i 'https://stubpoint.dev/api/endpoints' -H 'Content-Type: application/json' -d '{
  "body": "{\"items\":[],\"page\":{\"limit\":20,\"next_cursor\":null}}",
  "content_type": "application/json",
  "headers": null,
  "methods": [
    "GET"
  ],
  "status": 200
}'
200application/jsonGET

Last cursor page

Test the end of a cursor-based list.

Use template
View payload and cURL

Headers

none

Body

{
  "items": [
    {
      "id": "evt_099",
      "label": "Archived"
    },
    {
      "id": "evt_100",
      "label": "Closed"
    }
  ],
  "page": {
    "limit": 2,
    "next_cursor": null
  }
}

Create with cURL

curl -i 'https://stubpoint.dev/api/endpoints' -H 'Content-Type: application/json' -d '{
  "body": "{\n  \"items\": [\n    {\"id\": \"evt_099\", \"label\": \"Archived\"},\n    {\"id\": \"evt_100\", \"label\": \"Closed\"}\n  ],\n  \"page\": {\"limit\": 2, \"next_cursor\": null}\n}",
  "content_type": "application/json",
  "headers": null,
  "methods": [
    "GET"
  ],
  "status": 200
}'
200application/jsonGET

Offset page

Check clients that still read offset and limit metadata.

Use template
View payload and cURL

Headers

none

Body

{
  "items": [
    {
      "id": 21,
      "name": "North"
    },
    {
      "id": 22,
      "name": "South"
    }
  ],
  "pagination": {
    "offset": 20,
    "limit": 10,
    "total": 42
  }
}

Create with cURL

curl -i 'https://stubpoint.dev/api/endpoints' -H 'Content-Type: application/json' -d '{
  "body": "{\n  \"items\": [\n    {\"id\": 21, \"name\": \"North\"},\n    {\"id\": 22, \"name\": \"South\"}\n  ],\n  \"pagination\": {\"offset\": 20, \"limit\": 10, \"total\": 42}\n}",
  "content_type": "application/json",
  "headers": null,
  "methods": [
    "GET"
  ],
  "status": 200
}'

Other recipe shelves