Pagerduty python sdk

I’m following the following example: https://github.com/PagerDuty/API_Python_Examples/blob/master/REST_API_v2/Incidents/trigger_incident.py but can’t seem to find any documentation on service_id. Where do I get the service_id from? The second option is “FROM”, is that the user id or bot id that will be triggering the alert?

Hey,

We use python to interact with the PagerDuty API at RigD, however we use OAuth2 tokens which do require the FROM field. I dug back in some of our older code and FROM should be the email address of the user whom you are creating the incident on behalf of. so if it’s us just use your email address that maps to your PagerDuty user.

As for service_id that’s the is of the service you are opening the incident for. you can get that by making an GET call to ‘https://api.pagerduty.com/services’ or you can just look at the url while you are on the service page in the UI.

good luck!

1 Like

Justin’s reply is correct – the service_id is the service you’re creating an incident on, and you can use that API endpoint, or just use the URL if you’re using the UI to get the ID of the service.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.