Using REST with PowerShell Objects to Get and Put individual data
suggest changejsonplaceholder.typicode.com echoes the request and does not store it. GET one item into a PowerShell object:
$Post = Invoke-RestMethod -Uri "http://jsonplaceholder.typicode.com/posts/1"
Modify your data:
$Post.title = "New Title"
PUT the object 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