I can't figure out how to compose the request body described in this article.
I keep getting this error, regardless of if I have queries in my payload or not:
Invoke-RestMethod : {"$id":"1","innerException":null,"message":"Invalid argument value.\r\nParameter name: queries","typeName":"Microsoft.TeamFoundation.SourceControl.WebServer.InvalidArgumentValueException, Microsoft.TeamFoundation.SourceControl.WebServer","typeKey":"InvalidArgumentValueException","errorCode":0,"eventId":0}
I was attempting something like this:
$body= @{
queries=@(
@{
items=@(0,1,2)
type="commit"
}
)
results=@()
} | ConvertTo-Json
Invoke-RestMethod
Takes an object as input, not a json String. It does the conversion on its own. – Clijsters$body= @{ item= "test" } | convertto-json $url = "https://reqres.in/api/users" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $resp = Invoke-RestMethod -Method Post -Uri $url -Body $body -UseBasicParsing $resp
– Justin Holbrook