Create an extension API question

I created a Custom Incident Action using the PD Web Interface. When I query it via the API, I get something along the lines of the following;

{
“extensions”: [
{
“endpoint_url”: “https://myurl”,
“name”: “My Test”,
“config”: {
“referer”: “https://mysubdomain.pagerduty.com/configure_addons/custom_buttons
},
“extension_schema”: {
“id”: “PBIS5NX”,
“type”: “extension_schema_reference”,
“summary”: “Custom Incident Action”,
“self”: “https://api.pagerduty.com/extension_schemas/PBIS5NX”,
“html_url”: null
},
“extension_objects”: [
{
“id”: “P5ZRJRK”,
“type”: “service_reference”,
“summary”: "My Service,
“self”: “https://api.pagerduty.com/services/P5ZRJRK”,
“html_url”: “https://mysubdomain.pagerduty.com/service-directory/P5ZRJRK
}

If I try to create this programmatically it says that I must provide the Extension Schema ID. While I know what the extension_objects ID is going to be, it’s not clear to me how to obtain (or create) the extension schema ID. When I query the extension schema object I do not see the ID listed above.

How exactly do I determine the value for the extension_schema ID given that it is required? While I can obviously use this same ID for my PD subdomain my goal is to be able to create these in any environment. Is this an internal ID that is guaranteed to be found on every PD Instance? If so, does the fact that it points to api.pagerduty.com (vs a given subdomain) signify this?

Thanks very much,

ps.

Hi,

You can get a full list of extension schemas by querying the extension_schemas endpoint. These IDs are universal across all accounts and signify what type of extension to create. So, for example, P5ZRJRK is always the extension schema ID used to create a custom incident action.

You can confirm this by sending a GET request to https://api.pagerduty.com/extension_schemas/P5ZRJRK.

As a side note, all requests to the REST API go through http://api.pagerduty.com, and be routed to the correct account based on the API token used. No requests will use your subdomain in the url.

I hope this is helpful! Please let me know if you have any questions!

Josef

Josef.

Thanks very much for the quick reply and for confirming that P5ZRJRK is a global ID. As I mentioned I had queried the the extension_schemas endpoint and P5ZRJRK is definitely NOT in my list. Is it possible that this is a limitation of the ID that I’m using for my API calls or have I made a mistake somehow?

Thanks again,

ps.

P5ZRJRK is the ID for a service you associated the Custom Incident Action (CIA) with.

Sorry I just realized that I transposed the ids, P5ZRJRK is my service id not the extension schema id. That said PBIS5NX is also not listed in the extension schema.

Hi,

Apologies for my typo above. The ID is PBIS5NX, not P5ZRJRK. You can check this by sending a GET request to https://api.pagerduty.com/extension_schemas/PBIS5NX.

The reason that it may not appear on the first page of results if you query https://api.pagerduty.com/extension_schemas is due to our rules surrounding pagination. By default, we will return 25 results per response, which can be increased to 100 by using the limit parameter. After that, you will need to use the offset parameter in order to get all results.

Apologies for the mix-up on IDs! Let me know if you have any addtional questions.

Best,
Josef

1 Like

I had read about pagination but completely forgot about it here, I see it now and will (hopefully) keep that in mind going forward.

Thanks so much for the clarification.
Regards,

ps.