Below is the key value pairs I need to pass to the API. Dont know where Im going wrong
$Body = @{
hostName = 'null'
hostOperatingSystem = 0
optionalFilter1 = 'null'
optionalFilter2 = 'null'
description = 'null'
serviceName = "ServiceManager.Logging"
sectionName = "Services"
signature = 'null'
value = @( @{
Services = @( @{
FullPath = "..\Service\MicroService.exe"
InstanceCount = 2
})
})
} | ConvertTo-Json -Depth 4
$Response = Invoke-RestMethod -Uri $URI -Method PUT -Headers $Headers -Body $Body -ContentType 'application/json'
Below is the error I am getting
Invoke-RestMethod : {"":["JsonToken EndArray is not valid for closing JsonType Object. Path '', line 14, position 15."],"value":["Unexpected character encountered while parsing value: [. Path 'value', line 5, position 15."]}
This was the correct format