PowerShell and the Web – HTTP, REST, and JSON
Up until now, we’ve worked in a very small space – our client machine. It’s nice, but the world doesn’t work like that. Pretty much every device we use is connected to other machines and also, usually, the internet. Devices need to be able to interact with services provided over the web to download data, interact with cloud applications, and play games. In this, chapter we’re going to look at ways we can use PowerShell to work with objects in the world outside our box.
We’ll start out with a brief chat about web services and then look at the basic PowerShell tool for interacting with them; Invoke-WebRequest
. We’ll go on to look at Application Programming Interfaces (APIs). We’ll talk about the dominant type of API in use today – Representational State Transfer (REST). Once we’ve got a good grip on that and the tool we can use to work with it, Invoke-RestMethod...