Details
-
Suggestion
-
Resolution: Unresolved
-
None
Description
User Goals
In the current design, there's no direct pagination in the Opsgenie API or the Node.JS library for an easy way to craft the snippet for automation to list out all the alerts matching the designated filter.
Because the max value for the limit is 100 per API call, the only way is to code the function to fetch the offset value in the last field nested under the paging object in the 1st API call as a reference to determine how many API calls are required.
It will be relatively not easy to tailor the script and may consume more CPU cycles to accomplish the objective.
Possible Solutions
From the customer's perspective, It would be great if:
- Direct pagination is implemented in the Node.js library and the Opsgenie API endpoint.
- Get a total results field of some kind added to the response object.
Known Workarounds
In the result of the 1st API call, there is an object, paging, at the end of the result.
Among the child fields within paging, the field, last, contains the URL for the final API call which reveals the total amount of entries in the query result by leveraging the offset value.
The developer may tailor their snippet to fetch this value from the 1st API call to define the number of API calls they should make each time.