Thanks for the responses. I did try the suggestions but still get syntax errors. However I've decided I want to do this in Windows PowerShell and won't bother with filters. I can use the PS equivalent of Curl which is Invoke-RestMethod to get the serviceid from the service title by using the following script
$Service = Invoke-RestMethod -Credential perrinj2admin -Uri https://localhost:8089/servicesNS/nobody/SA-ITOA/itoa_interface/service
for ($i=0; $i -le $Service.count; $i++) {
if ($Service[$i].title -eq "293"){
$ServiceKey = $Service[$i]._key
$Service = $Service[$i].title
}
}
$Service, $ServiceKey
This works fine but the next step is to disable the service and I've tried the following script
$service = @{
_key='1132aed7-ba38-498c-98e2-edb29d4144f2'
enabled=0
}
$json = $service | ConvertTo-Json
$response = Invoke-RestMethod -Credential perrinj2admin -Uri 'https://localhost:8089/servicesNS/nobody/SA-ITOA/itoa_interface/service/bulk_update?is_partial_data=1' -Method Post -Body $json -ContentType 'application/json; charset=UTF-8'
$response
The response to this is
Invoke-RestMethod : {"message":"(400, 'Invalid upsert payload found, must be a valid JSON list.')"}
I've checked the output of the ConvertTo-Json and it's a valid JSON list.
Any thoughts on what could be wrong?
... View more