Paginated requests

This is how IHUB is configured for paginated responses



Usage

1 - Enter the endpoint URL, without the page/offset ie parameter

2 - Select the pagination option

3 - Add pagination variables. These variables will be appended to the URL above.

4 - Add a Breaking path, default is to break on an empty result, empty json response object or json array. All other status codes than 2XX is also breaking the pagination requests. 

Pagination Variables: 

The pagination variables will be evaluated and appended to the URL.

IHUB supports 3 types of pagination variables;  AUTO INCREMENTED, FIXED VALUE,  RESPONSE BASED VALUE

3a - Name of the variable

3b - The path or value for the variable

3c - The type (how to evaluate the variable) 

3d - A default/additional value

AUTO INCREMENTED

An auto-incremented variable is auto-incremented every time a request is made until the breaking path is resolved. 

Fill in the variable name (3a), start value (3b), type (3c) = AUTO_INCREMENTED, and the additional value to auto-increment by in (3d)

Example:

From the image above.

A paging variable "page" with the value 1, type: auto-increment, additional value: 100

Resolves:

Request 1:  http://server-url.com?page=1

Request 2:  http://server-url.com?page=101

Request 3:  http://server-url.com?page=201

Common usage:

The variable named: "offset"

FIXED VALUE

A fixed value is a pagination variable that is always the same. 

Fill in the variable name (3a), start value (3b), type (3c) = FIXED_VALUE. (Additional value is ignored)

Example:

From the image above.

A paging variable "limit" with the value 100, type: FIXED VALUE, additional value is left out (and ignored)

Resolves: 

Request 1:  http://server-url.com?limit=100

Request 2:  http://server-url.com?limit=100

Request 3:   http://server-url.com?limit=100

Common usage:

A result size limit variable, ie. "limit"

RESPONSE BASED VALUE

The response based value is a paging parameter that evaluates from the previous request-response.

Fill in the variable name (3a), start value (3b), type (3c) = RESPONSE_BASED_VALUE. Additional value is the default value if the response cannot be evaluated.

Example:

From the image above.

Given: The requested endpoint returns a JSON object containing a metadata object with a property next_cursor

json sample
{ "results":[...], "metadata": { "next_cursor":"qwertyu12345" } }



A paging variable "cursor" with the jsonpath value $.metadata.next_cursor, type: RESPONSE BASED VALUE, additional value is "default value" (most commonly this is left blank)

Resolves: 

Request 1:  http://server-url.com?cursor=default_value

Request 2:  http://server-url.com?cursor=qwertyu12345

Common usage:

API endpoints that returns a next page cursor  in the response

Breaking and stopping the pagination requests

IHUB will continue querying the URL endpoint until one of the following occurs:

  • The endpoint returns anything but the HTTP status code 2XX

  • The endpoint returns the same result as the previous page

  • The response that is returned is:

    • empty

    • an object that is empty (no properties) = {}

    • an empty array  = []

  • The breaking path entered in 4 above is evaluated as empty, empty object, or empty array 

Example:

A breaking path of $.results is added. Using the same JSON sample as above This will evaluate the response from the previous pagination request and break whenever the result is an empty array. 



NEXT URL VALUE



Examples:

Slack users:

Gets all slack users. 

  • cursor parameter value is: $.response_metadata.next_cursor



Insight:

Get objects from insight

Confluence

Get spaces

Jira

Example How to bulk update a large volume of issues with iHub





How to use the response

Logs & Data processing