This cheatsheet covers the principal PowerShell modules and cmdlets used to interact with REST APIs. It is intended for DevOps professionals managing integrations and troubleshooting API connections.
Invoke-RestMethod -Uri "https://api.example.com/data" -Method Get
Invoke-WebRequest -Uri "https://api.example.com/data" -Method Get
$object | ConvertTo-Json
(Get-Content response.json -Raw) | ConvertFrom-Json
$response = Invoke-RestMethod -Uri "https://api.example.com/data"
$response | Get-Content
$response | ConvertTo-Json | Set-Content -Path "C:\Logs\api-log.json"
Register-PSRepository -Name "PSGallery" -SourceLocation "https://www.powershellgallery.com/api/v2/"
Find-Module -Name Az
Install-Module -Name Az -Scope CurrentUser
Update-Module -Name Az