API Use Case achieved using Python Script

Prev Next

Client would like to pull all alert log data within a period with an API call in Postman. As currently structured, the call requires that client specify a maximum of 200 events per page, as well as the page number. This means client must do multiple executions to pull every page. Client would like assistance with a script or workaround to execute this once to get all data

Catchpoint UI allows a page size to be in the range of 0-200. Pagination is used when a lot of results are returned. We paginate the results to make sure responses are easier to handle. In client’s case there were more than 200 requests being returned because they were looking at getting data in a bigger time frame. (May1st to May 15th).

Workaround:

  1. Client could pull data more frequently like every day so that the result returned will be typically less than 200 results/call which means you can pull all your data for one day in one call. However, if the results exceed 200 then we need to use pagination.
  2. Every time you pull a page, there’s a flag that tells you if there are more pages and then you would have to continue to make the call for the next page until the flag is no longer there.

If the “has_more “= False, there are no further pages. This can be automated using a python script attached.

Please Note: This is a sample code and should not be instituted without proper QA on the client’s side. It is our policy not to create production code for clients, but we share this as a good example of how to solve the request.

automate_api.py