Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

cant create event #75

Open
gabrielfsousa opened this issue Mar 23, 2017 · 15 comments
Open

cant create event #75

gabrielfsousa opened this issue Mar 23, 2017 · 15 comments

Comments

@gabrielfsousa
Copy link

doing

curl -H "Content-type: application/json" -X POST -d '{"service_key":"MY_OPENDUTY_SERVICE_KEY","event_type":"trigger","description":"test","incident_key":"1234567"}' http://172.16.9.141:8000/api/create_event

get

{}

@krutaw
Copy link
Contributor

krutaw commented Mar 24, 2017

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.

@gabrielfsousa
Copy link
Author

found out yesterday, reading your case :) thanks a lot

can we create a service using api ?

@deathowl
Copy link
Contributor

Not yet, but that feature will come eventually. Check this for continously added features: github.com/openduty/openduty

@hanynowsky
Copy link

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

@kjetilmjos
Copy link

Have you created an escalation policy? I got the same problem when there was no escalation policy connected to the service

@kjetilmjos
Copy link

and also "Authorization: password_from_settings.py"

@hanynowsky
Copy link

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.

@kjetilmjos
Copy link

You have used the API key created in the service as service_key ?

@hanynowsky
Copy link

Sure.

@hanynowsky
Copy link

@kjetilmjos
Copy link

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

@hanynowsky
Copy link

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 📟

Thanks @kjetilmjos

@kjetilmjos
Copy link

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. #90

@hanynowsky
Copy link

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.

@kjetilmjos
Copy link

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: #49

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

No branches or pull requests

5 participants