Chapter 40. Working with the web
This chapter covers
- Getting data from a website
- Working with JSON
- Working with REST services
Web protocols have given us incredible access to data. Whether you’re consuming an XML feed from an internal web service, scraping HTML pages from the public internet, or interacting with REST services on a partner extranet, web technologies help make it happen. PowerShell is well connected to these technologies, too, meaning you can use it as a tool for automating those interactions.
Note
This chapter in particular focuses on Windows PowerShell v3 and v4. Much of what we’re discussing can be performed in older versions, but the shell itself lacks the commands. Instead, you end up working with the raw .NET Framework to accomplish these tasks. Cmdlets are always easier than raw .NET code.
At first glance this may seem to be a developer-oriented topic, but the administration tools of many software products within our environments are increasingly exposed as web services. As an administrator, you need to know how to access those services. First, though, how do you access a simple website?