get incident by incident name

Hi - I want to get the incident by using the incident name not incident id. Because in my application, if i have 10 incidents and I would like to resolve 7th one incident, and I don’t have a incident id so I will pass the incident name and I will fetch the particular incident. Is there any scenario?

Am trying the code as follows.

base_url = ‘https://api.pagerduty.com’

user_url = ‘{}/{}’.format(base_url, ‘incidents’)

payload = {
‘query’: incident_name,
}

r = requests.get(
user_url,
headers=self.request_headers,
params=payload,
)

print( r.json())

Hi @hushen, the GET incidents endpoint doesn’t have any request schema for filtering by incident title, so I would recommend doing a GET on your incidents and then iterating through them to find a match. You can add date filters to narrow down the incidents if required, as outlined in the request schema in those docs. Here are our pagination docs as well:

https://v2.developer.pagerduty.com/docs/pagination

Ok got it, Thank you @prupke