opsgenie/opsgenie-python-sdk

Offsets for more then 100 alerts?

Opened this issue · 1 comments

Noticed in https://github.com/opsgenie/opsgenie-python-sdk/blob/master/opsgenie/alert/requests.py#L46-L68 that offset wasnt a parameter that is allowed.

However offsets are part of the paging response:

        "next":"https://api.opsgenie.com/v2/alerts?query=status%3Aopen&offset=20&limit=10&sort=createdAt&order=desc",
        "first":"https://api.opsgenie.com/v2/alerts?query=status%3Aopen&offset=0&limit=10&sort=createdAt&order=desc",
        "last":"https://api.opsgenie.com/v2/alerts?query=status%3Aopen&offset=100&limit=10&sort=createdAt&order=desc"
    },
asqui commented

If you're writing new code you'll probably want to be using the swagger client in opsgenie.swagger_client (see https://docs.opsgenie.com/v1.0/docs/opsgenie-python-api).

With that being said, I did find that even with the swagger client this paging part of the response is not actually available in the response that I get. (Even if it was, I'm not sure how I would make use of the raw URLs in the response to fetch subsequent pages.)

My current approach (as suggested by OpsGenie support) is to retrieve responses in createdAt order, and use a filter on createdAt to achieve paging.