Blog Series: APIs and Powershell

Starting out on helpdesk and moving to systems administration, I never had any exposure to APIs and how to use them. I would be in meetings and people would start talking about APIs and this would be me.

Instead of being clueless, I would rather know a little bit when people smarter than me start talking. So I set out to start learning what exactly can be done with APIs and Powershell.


Powershell Tools for Accessing APIs

Some of the tools provided in Powershell I will be discussing in this series are:



Setting a variable to accept XML response (without quotes)
‘[‘xml’]’$somevariable =

when using Invoke-Restmethod, the output should be detected as XML, so you likely won’t need to specify XML before the variable.

Parsing HTML for results as well as posting HTML data.

And possibly more as I come across of.

Data Data Everywhere, But What to Do With It?

Getting the data wasn’t good enough for me. In those API discussions I mentioned previously, I have yet to see someone say getting the data was good enough. So these posts will also include posting the data to Azure Log Analytics, SQL, and maybe Azure CosmosDB. Once we have the data in a platform we can run queries and alert on issues and a lot more.


The Posts

Accessing Weather Underground API to get JSON result
Post Weather Data to Azure Log Analytics

Comparing Invoke-RestMethod to Invoke-WebRequest
Invoke-RestMethod vs Invoke-WebRequest

Using Powershell to parse HTML and XML to send data to Azure Log Analytics
Monitor your BBQ with Powershell and Azure Log Analytics

How to use Powershell to Post data into your Database in Cosmos DB
POST to Cosmos DB REST API with Powershell

Build a Powershell Serverless API with Azure Functions
Powershell Azure Functions: Serverless for Ops People

Use Azure Function to Post to Azure Log Analytics API
Timer Trigger Azure Function Post to Log Analytics