TheHiveDocs
TheHiveDocs copied to clipboard
alert API - Error: Invalid Json body for Alert.
Hi,
We've tried to add some alarms with IOCs via script using the API but keep getting "Error: Invalid Json body for Alert."
I've tried adding "-ContentType "application/json; charset=UFT-8"" which returns error 'UFT-8' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. Parameter name: name"
Also tried UTF8 with same result. TheHive 4.0RC, script triggered on Win Server 2016
Any ideas what we do wrong?
Many thanks Luk
This works for me on Windows, no special encoding required.
$headers = @{Authorization = "Bearer $thehiveKey"}
$alertBody = $alert | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri $uri -ContentType 'application/json' -Headers $headers -Body $alertBody