Hello,
I have a query that works with Postman
Postman body
{
“ObjectDN”: “toto”,
“AttributeName”: “Disabled”,
“Values”: [“1”]
}
I try in powershell
Powershell extract
$fullID = "toto"
function retire($fullID){
$json = @{ObjectDN=$fullID;AttributeName="Disabled";Values="1"}|ConvertTo-Json
$uri = $baseurl + '/Config/Write?apikey=' + $global:key
$statut = Invoke-RestMethod -Uri $uri -Body $json -Method POST -ContentType 'application/json'
if($statut.Result -eq $null){
return "error"
}else{
return $statut.Result
}
When I run it I have an error
« Invoke-RestMethod : {“Error”:“Unable to parse input document.”} »
I think the problem is the conversion of the line
“Values”: [“1”]
that works in Postman
but in powershell we can not use
I’m looking for a solution
Bests regards