Search

How to get a list of users in PagerDuty using REST API v2 and PowerShell

First get a API Key, skip if you already have a API Key.

Log into your PagerDuty instance, go to Configuration > API Access

 

Click on Create New API Key


Add a Description, then select Create Key

 

You should now have a PagerDuty API key

 


 

PagerDuty has an excellent API reference


Under the section for Users > Create a User they give us hints on how we can code this in PowerShell. We will be using the Invoke-RestMethod, and we will start with the header.

In the API reference page, we can try out the API calls, when click try PagerDuty shows all actions.


Also keep note of the method of "GET"



 

Requests Header



We need to transform it for the Invoke-RestMethod, this is how it should look like


 

Here is a example code


 

Lets build a function.




79 views0 comments

Recent Posts

See All