Invoke-RestMethod

Description

Sends an HTTP or HTTPS request to a RESTful web service and parses the response.

Command
Invoke-RestMethod
Examples
Get data from a public REST API
Invoke-RestMethod -Uri 'https://jsonplaceholder.typicode.com/todos/1'
Make a POST request with a JSON body
$body = @{ title = 'foo'; body = 'bar'; userId = 1 } | ConvertTo-Json; Invoke-RestMethod -Uri 'https://jsonplaceholder.typicode.com/posts' -Method POST -Body $body -ContentType 'application/json'
Parameters
Parameter Type Required Description
[-Uri] <Uri> string No Specifies the URI of the web resource.
[-Method <WebRequestMethod>] string No Specifies the HTTP method to use (e.g., GET, POST, PUT, DELETE).
[-Body <Object>] string No Specifies the body of the request for POST/PUT methods.
Command Info
Category: Networking
Type: Powershell
Views: 13
Status: Active
Tags
powershell web http rest api json xml irm