Using REST with PowerShell Objects to GET and POST many items

suggest change

GET your REST data and store in a PowerShell object:

$Users = Invoke-RestMethod -Uri "http://jsonplaceholder.typicode.com/users"

Modify many items in your data:

$Users[0].name = "John Smith"
$Users[0].email = "John.Smith@example.com"
$Users[1].name = "Jane Smith"
$Users[1].email = "Jane.Smith@example.com"

POST all of the REST data back:

$Json = $Users | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri "http://jsonplaceholder.typicode.com/users" -Body $Json -ContentType 'application/json'

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents