Commands / Network

Invoke-RestMethod

Call a JSON API

intermediate Network Aliases irm

Invoke-RestMethod
 Invoke-RestMethod -Uri 'https://example.com'
Works on
WindowsLinuxmacOS
PowerShell
5.1 and later
Reference
Microsoft Learn: Invoke-RestMethod

Like Invoke-WebRequest, but if the body is JSON you get objects back. Use -Method Post and -Body for writes. Do not put tokens in scripts you commit.

Try this

Invoke-RestMethod -Uri 'https://example.com' | Get-Member

Coming from another shell

ShellWhat you might type
bash / zshcurl -s https://api.example.com/items | jq

More in From bash and From cmd.

Related commands