Hi @gsmith, here is the new post about the Invoke-RestMethod which returns the following error message. The following is a continuation of the following post PowerShell and REST API stream search.
----------------------Displayed Error------------------------------------------------------------------
Invoke-RestMethod : Unable to export as JSON - Enterprise license is missing or invalid!
At line:5 char:6
- $r = Invoke-RestMethod -Uri $Uri_Search -Credential $cred -Method Pos …
-
```
* CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
* FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
----------------------Displayed Error------------------------------------------------------------------
The above error is returned when the below script is run under Windows ISE.
------------------------- API Call ---------------------------
$Uri_Search = “https://lnx.server.net:9000/api/views/search/messages”
$Headers = @{ Accept = ‘application/json’; ‘X-Requested-By’ = ‘GraylogScript’ }
$r = Invoke-RestMethod -Uri $Uri_Search -Credential $cred -Method Post -ContentType ‘application/json’ -Headers $Headers -Body ‘{
“streams”: [
“6105272292dfc35e022c94b3”
],
“query_string”: {
“type”: “elasticsearch”,
“query_string”: “*”
},
“timerange”: {
“type”: “relative”,
“range”: 300
}
}’
Let me know if there is a solution to this or if it is expected behaviour.
