morgan_sziraki Jun 29, 2016 8:33 AM
When I try to make a POST API call:
curl -X PUT --header "Content-Type: application/json" --header "Accept: application/json" -d '{ "name":"bob_test_alert_2", "condition":"ts(%22honeycomb.staging.SCS.app.NodeStateRepository-findOne-execution-time.count%22)%20%3E%200", "minutes":"2", "notifications":"bob%40domain.com", "severity":"SMOKE" }' "https://mydomain.wavefront.com/api/alert/create" -H 'X-AUTH-TOKEN: dd5b7179-c771-4212-8d09-b42d29aXXXXX'
I get the following response:
{"code":400,"message":"Unable to process JSON"}
---
Is JSON not supported ?
Correct Answer by vasily@wavefront.com on Jun 29, 2016 10:21 AM
Hi Morgan,
The /alert/create method expects an application/x-www-form-urlencoded content type, so your call would look slightly different:
curl -X POST --header "Content-Type: application/x-www-form-urlencoded" -d 'name=bob_test_alert_2&condition=ts(%22honeycomb.staging.SCS.app.NodeStateRepository-findOne-execution-time.count%22)%20%3E%200&minutes=2¬ifications=bob%40domain.com&severity=SMOKE' "https://mydomain.wavefront.com/api/alert/create" -H 'X-AUTH-TOKEN: dd5b7179-c771-4212-8d09-b42d29aXXXXX'
Please let us know if this works for you!
-Vasily
1 of 1 people found this helpful
Correct Answer by vasily@wavefront.com on Jun 29, 2016 10:21 AM
Hi Morgan,
The /alert/create method expects an application/x-www-form-urlencoded content type, so your call would look slightly different:
curl -X POST --header "Content-Type: application/x-www-form-urlencoded" -d 'name=bob_test_alert_2&condition=ts(%22honeycomb.staging.SCS.app.NodeStateRepository-findOne-execution-time.count%22)%20%3E%200&minutes=2¬ifications=bob%40domain.com&severity=SMOKE' "https://mydomain.wavefront.com/api/alert/create" -H 'X-AUTH-TOKEN: dd5b7179-c771-4212-8d09-b42d29aXXXXX'
Please let us know if this works for you!
-Vasily
1 of 1 people found this helpful
morgan_sziraki Jun 29, 2016 10:59 AM (in response to vasily@wavefront.com)
thank you. I have that working.. was hoping to post json
directly rather than parse and build .. no worries
On 29 Jun 2016 18:21, "vasily@wavefront.com" <