How to test connectivity with Pagerduty using REST api without creating an incident/alert

hi All,

As a developer,

I want users to test connectivity with Pagerduty without creating an alert/incident. I want to use REST api GET method for the same. Could you please help me on how to achieve this. I want to validate if users have passed valid authetication token and integration key.

By sending proper request using POST method with all the required values I am able to get the response successfully but that is creating an alert in my service which i don’t want just for testing the connectivity.

Hi Priyabrata,

If you would like to test connectivity by means of successfully making a REST API call without wanting an incident to trigger, you could utilize one of our API endpoints that do not cause an object to be created. As an example, perhaps you can List Incidents instead of Creating an Incident?

We have various other API endpoints that you can make GET requests to listed in our API Reference page here:

https://api-reference.pagerduty.com/

Hey Malcolm,

Thanks for your reply, But how would I able to verify if the declared authentication token and integration key are valid or not. Without creating an event.

GET requests when tried, by just hitting the URL :- “https://api.pagerduty.com/” without passing any headers or request body . We are getting response as 200 ok

URL:- https://api.pagerduty.com/api_reference is returning 404 not found even if we are passing proper headers with Accept and Authorization

Hi Priyabrata,

If you do a GET on your incidents and see incidents returned in your response, this means the key is valid. You can refer to the Response Schema on the right side of those docs to see the expected response.

If the key you are using is invalid, you will get a response like this:

{
  "error": "no response from server"
}

Hi Malcolm,

I can have n numbers of integration keys for different services. How would i be able to verify each of them. Also I don’t have any incident created to get the response on. Its a totally new account. And in production systems I cannot create a dummy event/incident just for authentication purpose.

Isn’t there any way we can validate the auth token and integration ket without creating an event.

Hi Priyabrata,

At the moment we do not have any endpoints that specifically check the validity of an integration key.

Our REST API endpoint to GET /services can be used. If you include integrations, then the integration keys will be returned in the response as well. You can then parse this to determine if the given key matches one of the returned keys.

At the moment, we don’t have a more streamlined way to validate an integration key, but we’re happy to pass this feedback along to our product team.

Hi Jade,

Thanks for your reply. I tested the GET services and from what I saw it does a contains search on the integration key that we pass, it doesn’t do equals matching with the integration key. Eg:- If I am sending just some characters of the integration key, still I am getting the proper response with the services details.

Hi Priyabrata,

The endpoint you need is get_services.

Thanks.

HI,

Did you read what I asked. Please read the same and let me know if there is any such GEt service that does the exact match for the integration key that we pass.

Hi Priyabrata!

It appears an agent shared how to achieve this with you earlier today. For visibility, I will post it here:

To find an incident after triggering via the events API, you can do so by passing the dedup_key in the response at the endpoint: https://api-reference.pagerduty.com/#!/Incidents/get_incidents

The request URI would be: https://api.pagerduty.com/incidents?incident_key=DEDUP_KEY

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