I'm still having issues with getting json working with the curl command in powershell.
even a simple request to POST something into elastic fails miserably with the error
Unexpected character ('D' (code 68)): was expecting double-quote to start field name
I've stripped the script down to the basics just to try and test curl and json and still get failures
$curlExe = "h:\powershell\esb\elastic\curl\curl.exe"
$elasticdata = @{
timereceived = "test"
timesent = "testing"
name = "anon"
status = 0
}
$curldata = $elasticdata | convertto-json -Compress
$elasticoutput = "h:\powershell\esb\elastic\elastic.txt"
$elastichost = "http://localhost:9200/newtest20/filecopy/?pretty"
$elasticheader = "content-type: application/json"
$elamethod = "POST"
$curlargs = $elastichost,
'-X',$elamethod,
'-d',$curldata,
'-H',$elasticheader
& $curlexe @curlargs