Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offsets for more then 100 alerts? #8

Open
patrickpierson opened this issue Sep 11, 2017 · 1 comment
Open

Offsets for more then 100 alerts? #8

patrickpierson opened this issue Sep 11, 2017 · 1 comment

Comments

@patrickpierson
Copy link

patrickpierson commented Sep 11, 2017

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
Copy link

asqui commented Sep 13, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants