Unusual Results with REST /records/search endpoint

I’m using powershell to query the REST API /records/search endpoint for CIDR formatted subnets.
The script uses the Invoke-RestMethod and loops through a list of subnets generated with Import-CSV with ForEach. It uses the following json block in the body:

{
  "from": "-48h",
  "filter": {
    "field": ".ipaddr",
    "operand": "$($ip.ip)",
    "operator": "="
  }
}

The list is 68 subnets long and if I run the script against the full list, zero records are returned for each search. Which is incorrect because a manual spot check via the UI shows results for at least 3 of the 68 items.

If I cut the list of subnets down to three (specifically the ones that returned results in the UI) and run the script against that list, results are returned. If I manually add the subnet to the json body and run the Invoke-RestMethod cmdlet, results are returned. It’s only when I run the script against the full list that I get no results for any of the subnets.

Is there a limitation to how many queries the endpoint can handle within a specific timeframe?

EDIT: If it matters, I’m not interested in the returned records, only the value of total; I only need to know if the subnet appears in the records search

Issue resolved. Had to move the value for the body parameter from a variable ($body) directly to -body like so:

foreach($ip in $ips) {Write-Host $ip.ip; Invoke-RestMethod -Uri $url -Method 'POST' -Headers $headers -Body @"

{

   "from": "-48h",

   "filter": {

     "field": ".ipaddr",

     "operand": "$($ip.ip)",

     "operator": "="

   }

}

"@

}