Open gabrielfsousa opened 7 years ago
You're missing the authorization token. Here's an example of my curl command that I use in my DEV environment:
curl --insecure -H "Content-type: application/json" -H "Authorization: token thisismysecret" -X POST -d '{"service_key":"b893c504c51c26c720056ed94ec53049b9b9d0a4","event_type":"trigger","description":"test","incident_key":"1234567","details":"Details here"}' http://192.168.0.92:9080/api/create_event
Note, the service_key is the API Key from the service that I want to send the alert to in OpenDuty. I only mention that in case you hadn't replaced your service key with the text you included. Also, the token "thisismysecret" is the secret token defined within the settings.py.
found out yesterday, reading your case :) thanks a lot
can we create a service using api ?
Not yet, but that feature will come eventually. Check this for continously added features: github.com/openduty/openduty
We are facing the same problem here:
curl --insecure -H "Content-type: application/json" -H "Authorization: token mySettingsSecretKey" -X POST -d '{"service_key":" 5b10505a55a41b6fd2664579d5521b6adad8689d","event_type":"trigger","description":"test","incident_key":"1244567","details":"Details here"}' http://127.0.0.1:8000/api/create_event
{}
" Log: [19/Sep/2017 15:20:48] "POST /api/create_event HTTP/1.1" 403 2
Any hint on what might be wrong. Everything is setup. Service key, Sekret key, users, service... etc
Have you created an escalation policy? I got the same problem when there was no escalation policy connected to the service
and also "Authorization: password_from_settings.py"
Everything is setup correctly. Escalation policy is assigned to the service. But no luck. I am clueless. The Authorization is the password from settings.py. Yes.
You have used the API key created in the service as service_key ?
Hmm. This is the curl I'm using and it works.
curl --insecure -H "Content-type: application/json" -H "Authorization: <<secret<<" -X POST -d '{"service_key":"<<apikey<<","event_type":"trigger","description":"test","incident_key":"123425","details":"Details here"}' http://172.16.200.160:8000/api/create_event
Ok I found the cause. Shame on me :(
It was a typo mistake in the service key.
Look at my earlier command:
curl --insecure -H "Content-type: application/json" -H "Authorization: token mySettingsSecretKey" -X POST -d '{"service_key":" 5b10505a55a41b6fd2664579d5521b6adad8689d","event_type":"trigger","description":"test","incident_key":"1244567","details":"Details here"}' http://127.0.0.1:8000/api/create_event
There was a blank space before the first character of the service_key: "service_key":" 5b10505a55a41b6fd2664579d5521b6adad8689d"
FIXED NOW :pager:
Thanks @kjetilmjos
That's good news! I'm having some problems with notifications. Think it has something with the celery task queue to do. Would be interesting to hear if you encounter the same problem. https://github.com/ustream/openduty/issues/90
The Twilio Notification works fine for me. I receive SMS. The email notification has an issue. It does not work. The task is executed but after 254 seconds, reports an error. I am going to check shortly again what error it reports.
So you didn't have to do any code changes to the notification part? What OS are you running on? This is what I had to do to get email working: https://github.com/ustream/openduty/issues/49
doing
get