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

Alert Policies API is Depreceted #31

Open
amirkav opened this issue Jul 12, 2016 · 3 comments
Open

Alert Policies API is Depreceted #31

amirkav opened this issue Jul 12, 2016 · 3 comments

Comments

@amirkav
Copy link

amirkav commented Jul 12, 2016

Hi,

When I follow the docs to get alert policies, I get the following error:

Traceback (most recent call last):
File ".../newrelic_api/alert_policies.py", line 95, in list
params=self.build_param_string(filters)
File ".../newrelic_api/base.py", line 47, in _get
raise NewRelicAPIServerException('{}: {}'.format(response.status_code, response.text))
NewRelicAPIServerException: 410: {"error":{"title":"The alert policies API is deprecated. Please see 'alerts.newrelic.com' for the new alerting infrastructure."}}

Any idea why this is happening? When I test the GET query on New Relic's API Explorer or when I use Perl to import the data, I don't have any problems.
Maybe there is something wrong with the way the header parameters are created?

@caseybecking
Copy link

Couple things need to be updated to make this work -

alert_policies
Needs to be changed to
alerts_policies

And for the response on it
marketing_policy = AlertPolicies().list( filter_name='Marketing Policy', filter_type=['application'], filter_enabled=True )['alert_policies'][0]

Would become

marketing_policy = AlertPolicies().list( filter_name='Marketing Policy', filter_type=['application'], filter_enabled=True )['policies'][0]

@caseybecking
Copy link

I can send a PR not sure what else it would need?

@caseybecking
Copy link

And looks like I spoke to soon a PR has already been submitted -
#29

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

No branches or pull requests

2 participants