Should I use convert-tojson or roll my own. Should I use invoke-restrequest, invokeweb-request, System.net.WebClient or system.net.http.HttpClient?
Sometimes I seem to post successfully, although the data isn't indexed.
{"_index":"dropstorage","_type":"connectionstats","_id":"97e156a5-4d16-48d4-84e8-fcc723aea1ae",
"_version":1,"found":true,"_source":{
"hnas": 1,
"active": 70,
"id": "97e156a5-4d16-48d4-84e8-fcc723aea1ae",
"total": "70",
"date": "4/9/2015 9:03:36 AM"
}}
I would recommend the following approach:
$body = ConvertTo-Json $curatorResult -Compress
Invoke-RestMethod -Method Post -Uri $uri -ContentType 'application/json'-Body $body -ErrorAction Stop | Out-Null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With