I am trying to use a REST API to configure some alerts in RecoverPoint for Virtual Machines (RP4VM). I am trying to enter multiple filters at the same using json. The json file looks like this:
[
{
  "JsonSubType": "SystemEventLogsFilter",
  "level": "WARNING",
  "scope": "NORMAL",
  "eventsIDs": [],
  "filterUID": {
    "id": 1570417688566256135
  },
  "name": "RPA_issue",
  "topic": "RPA",
  "groupsToInclude": null
},
{
  "JsonSubType": "SystemEventLogsFilter",
  "level": "WARNING",
  "scope": "ADVANCED",
  "eventsIDs": [],
  "filterUID": {
    "id": -1728986321682574312
  },
  "name": "cluster_events",
  "topic": "CLUSTER",
  "groupsToInclude": null
}
]
When I try to run the script I get an error:
Unexpected token (START_ARRAY), expected START_OBJECT: need JSON Object to contain As.PROPERTY type information (for class com.emc.fapi.version5_2.commons.SystemEventLogsFilter)
 at [Source: org.apache.catalina.connector.CoyoteInputStream@75b592c2; line: 1, column: 1]
If I remove the square brackets it does the first value but not the second. Is this an issue with my code or an issue with theirs?
The script:
$rp4vmcl = import-csv -Path .\test_clusters.csv
$credential = Get-Credential
$username = $credential.GetNetworkCredential().UserName
$password = $credential.GetNetworkCredential().password
$credPair = "$($username):$($password)"
$encodedCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($credPair))
$headers = @{ 
    Authorization = "Basic $encodedCredentials"; 
    "Accept" = "application/json";
    "Content-Type" = "application/json"
}
$comp = "/system/event_logs_filters"
$json = Get-Content .\event_log_filter.json -Raw
foreach ($s in $rp4vmcl) {
    $cluster = $s.cluster_name
    $uid = $s.cluster_uid
    $curl = $s.cluster_url
    $url = "$curl$comp"
    $cluster
    $results = Invoke-RestMethod -Method POST -uri $url -SkipCertificateCheck -Headers $headers -Body $json
}
 
    