Using REST with PowerShell Objects to Get and Put individual data
suggest changeGET your REST data and store in a PowerShell object:
$Post = Invoke-RestMethod -Uri "http://jsonplaceholder.typicode.com/posts/1"
Modify your data:
$Post.title = "New Title"
PUT the REST data back
$Json = $Post | ConvertTo-Json
Invoke-RestMethod -Method Put -Uri "http://jsonplaceholder.typicode.com/posts/1" -Body $Json -ContentType 'application/json'
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents