Pagerduty resolve

Hi - I’ve been able to successfully create incidents in the developer V2 API reference site then I would like to resolve the incident with calling the rest API by passing the payload object.
import requests
import json
base_url = ‘
request_headers = {
‘Authorization’: ‘Token token={token}’.format(token=self.token),
‘Content-type’: ‘application/json’
update_url=’{}/incidents/{}/resolve’.format(base_url, ‘incident_id’)
r = requests.put(update_url,headers=request_headers )

So, am getting the not found error as follows.
{‘error’: {‘message’: ‘Not Found’, ‘code’: 2100}}

  • I think am doing something wrong, can you please help me out to resolve the incident using rest API.

Hi @hushen! Welcome to the Community!

I see a couple of things you could try. You need an additional header in your request_headers for from. The value of this will be the email address of the account resolving the issue. The header would look something like 'from': ''.

Also, to resolve the incident you want to actually pass the resolve status in the body of the request and remove the word resolve from the url. Instead just call {}/incidents/{} and then pass a body of

body = json.dumps({
    'incident': {
            'type': 'incident_reference',
            'status': 'resolved'
r = requests.put(update_url,headers=request_headers, data=body )

Give that a shot and let us know if you have any other questions or issues.

Thank you @smcallister. It’s working fine now.

One more thing. Is there any way to get particular incident ?. I know it will work with incident id, but I want it by passing an incident name.

No there is not an API endpoint for getting an incident by name. There is only one for getting an incident by id.

ok fine, Thank you @smcallister

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