PagerDuty / pdpyras

Low-level PagerDuty REST/Events API client for Python
MIT License
129 stars 29 forks source link

how can I get the audit records #73

Closed sorin2343 closed 2 years ago

sorin2343 commented 2 years ago

hello ,

how can I get the /audit/records? look at https://developer.pagerduty.com/api-reference/reference/REST/openapiv3.json/paths/~1audit~1records/get

thanks sorin

Deconstrained commented 2 years ago

Hi @sorin2343 ,

You can do this by calling <session object>.get("/audit/records") and optionally include a params keyword argument (a dictionary object). The return value of that is a Requests.Response object, so <response object>.json() gives you a dictionary object representing the JSON data in the response.

Note that the next_cursor key in the response body, which can be sent in as the cursor parameter in the next request (via params keyword argument) to obtain the next page of results.

The iter_all function doesn't yet natively support cursor-based pagination, although this will likely be the next significant feature that to be added to the library.