HTTP Alert Sample Scripts
Reading time ~1 minutes
The Cinegy EAS Gateway service supports a simple HTTP protocol for triggering an EAS event. This is provided for easy testing of the system when a physical EAS device is not available.
The below samples of PowerShell scripts demonstrate how to raise and terminate HTTP alerts.
Raise Alert
function Invoke-HTTPMethod($MethodUrl, $Method="GET", $Body="")
{
$web = new-object net.webclient
# $web.Headers.add("Accept", "application/json, text/javascript, */*; q=0.01")
if($Method -eq "GET")
{
$web.DownloadString(${MethodUrl})
}
if($Method -eq "POST")
{
$web.UploadString(${MethodUrl},$Body)
}
}
$body = "<HTTPAlert TextToDisplay=`"Alert Message Text`" Duration=`"30`"><Audio Mode=`"Synthetic`" TextToSpeech=`"EAS voice alarm!`" /></HTTPAlert>"
Invoke-HTTPMethod -MethodUrl "http://localhost:8090/EASGateway/RaiseAlert" -Method "POST" -Body $body
pause
Stop Alert
function Invoke-HTTPMethod($MethodUrl, $Method="GET", $Body="")
{
$web = new-object net.webclient
# $web.Headers.add("Accept", "application/json, text/javascript, */*; q=0.01")
if($Method -eq "GET")
{
$web.DownloadString(${MethodUrl})
}
if($Method -eq "POST")
{
$web.UploadString(${MethodUrl},$Body)
}
}
Invoke-HTTPMethod -MethodUrl "http://localhost:8090/EASGateway/StopAlert" -Method "POST" -Body ""
pause
Syntax
Parameter | Value | ||
---|---|---|---|
Audio Mode |
"Synthetic" |
||
"Bypass" |
|||
"None" |
|||
TextToSpeech |
"Displayed"
|
||
TextToDisplay |
Alert message text |
||
Duration |
Alert message duration
|