Powershell Rest API Default Template

Reading Time: 2 minutes

Powershell Rest API Default Template

Recently while working a contract for a state government position, I was tasked with finding areas within a specific department where automation can reduce repetition of redundant tasks. Many help desk technicians were creating the same exact help ticket over and over again. In turn I created a simple powershell script that hooked into the ticketing softwares API and automatically opened and closed a support request. Here is an example of the script below.

The code

$url = "http://yourwebsitehere.com”

$api = “API Key Here“

$method = "POST"

$operation = "GET_REQUESTS"

$inputdata = @"


    “Pass Json info here”



$params = @{INPUT_DATA=$inputdata;OPERATION_NAME=$operation;TECHNICIAN_KEY=$api;format='json'}

$result = Invoke-WebRequest -Uri $url -Method $method -Body $params


Impact of the script

I was able to add this script into a prebuilt GUI and made it run off of a click of a button. The help desk techs went from spending 1-2 minutes creating the same ticket 10-15 daily to 2-3 seconds on clicking a button instead. There were a total of 8 techs in the department, so the script was able to save between 7-15 repetitive hours a week combined. Its great to see how something so subtle can cause a huge impact.


Interested in learning powershell?

The first book and only book I read to learn Powershell was “Learn Powershell In A Month of Lunches” Within the first few chapters, I was creating helpful scripts in a work environment. Learn Windows PowerShell in a Month of Lunches, Third Edition is an innovative tutorial designed for busy IT professionals. Just set aside one hour a day – lunchtime would be perfect – for a month, and you’ll be automating Windows tasks faster than you ever thought possible. This updated edition covers PowerShell features that run on Windows 7, Windows Server 2008 R2 and later, PowerShell v3 and later, and includes v5 features like PowerShellGet.



Leave a Reply

Your email address will not be published.