When working with AWS Systems Manager (SSM) APIs, you may encounter paginated responses where only a subset of data is returned in each API call. To fetch all the data, you need to implement pagination in your API calls. This guide will show you how to configure ZappySys JSON Source to handle pagination for the DescribeInstanceInformation
operation of AWS SSM.
Step 1: Configure the JSON Source
- Access Mode: Set the
Access Mode
toFile path or web URL
. - Enter Path or Web URL: Enter the API endpoint URL. For example:
https://enter-url
. - HTTP Request Method: Set the method to
POST
. - Body (Request Data): Provide the JSON body for the request. Use placeholders for pagination tokens, such as:
{
"MaxResults": 50,
"NextToken": "{$pagetoken$}"
}
- Body Content Type: Select
JSON (application/json)
.
Step 2: Enable Pagination
- Go to the Pagination tab.
- Paging Mode: Select
Response Attribute Mode - Read next page information from response
. - Next Link/Cursor Expression: Enter the JSONPath expression to extract the pagination token from the API response. For example:
$.NextToken
- Stop Indicator Attribute: Leave this blank unless your API provides a specific attribute or value to signal the end of the data.
Step 3: Configure Advanced Pagination Settings
- Go to the Advanced Pagination tab.
- Enable Page Token for Body: Check the box to enable page token usage in the request body.
- First Page Body: Define the JSON body for the first request. For example:
{
"MaxResults": 50
}
- Next Page Body: Define the JSON body for subsequent requests, using the `$pagetoken placeholder. For example:
{
"MaxResults": 50,
"NextToken": "{$pagetoken$}"
}
Step 4: Test and Validate
- After configuring the settings, click Preview Data to test your setup.
- Verify that the API fetches all pages of data by automatically appending the
NextToken
in subsequent requests.
Additional Tips
- If the API does not return a
NextToken
in the response, ZappySys will stop fetching additional pages. - Use the Read Console Output link in the JSON Source to debug and view detailed logs of the API requests and responses.
- Adjust the
MaxResults
parameter based on your API’s limits.
By following these steps, you can efficiently handle paginated responses from AWS SSM using ZappySys JSON Source.