I'm trying to convert a cURL check into a PowerShell Invoke-WebRequest monitor, but can't seem to get SAM to return results I can get in Postman or PS.
When running this, I get results, but plugging it into SAM, I get nothing.
######### MY POWERSHELL script #########
$uri = "">MYINTERNALAPIURI.com/.../rawQuery"
$method = "POST"
$contentType = "application/json"
$objectOrder = "done"
$body = "{`n `"index`": `"dmstransient`",`n `"sort`": [`"globalPosition:asc`"],`n `"size`": 1, `n `"track_total_hits`": true,`n `"body`": {`n `"_source`": [`n `"recordStatus`",`n `"streamName`",`n `"type`",`n `"categoryStream`",`n `"messageId`"`n ],`n `"query`": {`n `"bool`": {`n `"must`": [`n {`n `"query_string`": {`n `"query`": `"recordStatus:$($objectOrder)`"`n }`n }`n ]`n }`n }`n }`n}"
$response = Invoke-WebRequest -Uri $uri -Method Post -ContentType $contentType -Body $body
$result = ConvertFrom-Json $Response.Content
[INT]$stat = $result.total
Write-Output "Statistic.Records: $stat"
Write-Output "Message.Records: Total Done Records: $stat"
My results:
PS /Users/> $response = Invoke-WebRequest -Uri $uri -Method Post -ContentType $contentType -Body $body
PS /Users/>
PS /Users/> $result = ConvertFrom-Json $Response.Content
PS /Users/> [INT]$stat = $result.total
PS /Users/>
PS /Users/> Write-Output "Statistic.Records: $stat"
Statistic.Records: 600556745
PS /Users/> Write-Output "Message.Records: Total Done Records: $stat"
Message.Records: Total Done Records: 600556745

######### But, in SAM, the resutls come back as 0 #########

Any thoughts on what I'm missing?