Professional Documents
Culture Documents
SecurOS_HTTP_EventGate_Guide_v170518
SecurOS_HTTP_EventGate_Guide_v170518
Request syntax
Checking Request Correctness
SecurOS Events
Custom HTTP Requests
Configuring HTTP Request Filter
Creating HTTP Request Handler
HTTP_EVENT_PROXY Events
HTTP_EVENT_PROXY Commands
Streaming via HTTP Event Gate
HTTP Event Gate is used for transmitting data from an external system to SecurOS. Data is transmitted via HTTP GET/POST requests.
To transmit data to SecurOS, an external system should send a request to the specified port number of the HTTP server.
Request syntax
http://<video_server_IP_address>:<port>/event?<param1_name>=<param1_value>[&<param2_name>=<param2_value>[& . . . ]], where:
For example,
to transmit to SecurOS a license plate and coordinates of the vehicle, one should send the following request: http://172.16.1.41:808
0/event?plate=135&latitude=57.6565&longitude=37.8787,
or the following request to transmit a persons' name : http://172.16.1.41:8080/event?name=Alex
If the following request was sent: http://172.16.1.41:8080/event?plate=135&latitude=57.6565&longitude=37.8787, the server will return the
following string in the browser window: Event(HTTP_EVENT_PROXY|1|RECEIVED|_body<>,_method<GET>,_path</event>,_peer_address
<::1>,latitude<57.6565>,longitude<37.8787>,plate<135>) has been sent to SecurOS, where:
Thus, if the following request was sent: http://172.16.1.41:8080/event?plate=135&latitude=57.6565&longitude=37.8787, then the following
event will be generated within SecurOS: Event : HTTP_EVENT_PROXY 1 RECEIVED
_body<>,plate<135>,_method<GET>,latitude<57.6565>,_path</event>,_peer_address<::1>,longitude<37.8787>,slave_id<S-PROKHOROV.
1>,owner<S-PROKHOROV>,date<19-12-14>,time<12:11:39.340>,core_global<1>
HTTP_EVENT_PROXY Events
custom Custom parameters are defined by the query contents (see Request syntax).
parameters
RECEIVED Incoming custom _path Substring of the URL between :port and ?.
request
For example, if request string is http://ip:port/path/is?param1=value1, then the /path/is subs
tring will be the parameter value
custom Custom parameters are defined by the query contents (see Request syntax ).
parameters
HTTP_EVENT_PROXY Commands
RESPONSE Send a respond for the received request PENDING _id Request identifier received within the PENDING_REQUEST.
_REQUEST. Required parameter.
text/plain; charset=utf-8,
application/json; charset=utf-8 и т.д.
//Request handler
function fRequestHandler(e){
switch(e._path){
case "/get-analytics": fGetAnalytics(e, e._id); break;
case "/get-detectors": fGetAnalytics(e, e._id); break;
default:
if( e._path.match(/get-config/ ) fGetConfig(e, e._path, e._id);
break;
}
}
//Response example
function fGetAnalytics(e, request_id){
...
var text= "<xml><param>value</param></xml>";
Core.DoReact("HTTP_EVENT_PROXY","1","RESPONSE","_id",request_id,"_body", text);
}
function fGetAnalytics(e, id){ ... }
function fGetConfig(e, path, id){ ... }