Is the Nx Cloud up? Visit our Status Page for the current health and performance of the Nx Cloud.

Status Page

How to use execHttpRequestAction and it complete functionality

Answered

Comments

9 comments

  • Andrey Terentyev
    • Network Optix team

    Hi Vishal,

    The execHttpRequestAction event type corresponds to Do HTTP request action in "Camera rules..." window of Nx Desktop.

    You can read more about configuring camera rules in the built-in Nx user manual of Nx Desktop.

    For more details, let me first explain the general idea and schema and afterwards the method of how to make the solution automated.
    Let's assume, you want to feed motion detection event on a camera with ID "camera1" to your middleware.

    Here is the manual procedure.

    1. Create a type 1 rule.
    When: Motion on Camera.
    At: camera1
    Action: Do HTTP Request.
    HTTP URL: the URL for api/createEvent API for triggering Generic Event.
    For example,
    http://127.0.0.1:7001/api/createEvent?source=camera1&caption=caption1&description=desctription1

    2. Create a type 2 rule.
    This is supposed to be a rule for processing Generic event, triggered by Type 1 rule.
    In our example it should be configured similar to
    When: Generic Event
    Source contains: camera1
    Caption contains: caption1
    Description contains: description1
    Action: Do HTTP Request.
    The "HTTP URL" and "HTTP content" should contain your middleware specific code. In order to pass values insert into you code
    {event.source}
    {event.caption}
    {event.description}

    In our example,
    {event.source}=camera1
    {event.caption}=caption1
    {event.description}=description1

    You could refer to https://support.networkoptix.com/hc/en-us/community/posts/360031203493-Surpress-temporarily-actions-showOnAlarmLayout-and-showNotification-for-a-specific-camera
    for detailed example of configuring Generic rule and Do HTTP Request action.

    To make configuration easier you probably want to make a script for creating these types of rules, which would comprise such steps.

    1. Identify cameras, the rules have to be created for.
    - you could insert special symbols to camera name
    - you could read cameras from a config files (camera names or ip addresses or camera ID)

    2. Determine camera ID by calling /ec2/getCamerasEx and parsing the output and filtering the camera based on the data of step 1.

    3. Create rules type 1 and type 2
    - call getEventRules for checking already existing rules
    - to avoid duplicates you could put some tags in the "comment:" field.
    - create/update rules by calling saveEventRule

    Of course, while automating the stage Stage 1. Create a type 1 rule. via API you can right away put the code of the request to your middleware to HTTP URL and HTTP Content fields, and avoid stage 2. Create a type 2 rule, because from  /ec2/getCamerasEx you know all information on camera needed to build specific HTTP request parameters.

    0
  • Permanently deleted user

    Thanks Andrey Terentyev

    But I want to receive a notification on my custom server on which I am integrating Network Optix through APIs. I want to know if there is any method in which I gave an API to Event Rule and whenever motion is detected it will hit given API with the post or put method and send details in the request body.

    0
  • Andrey Terentyev
    • Network Optix team
     
    Hello Vishal,
     
    > I want to know if there is any method in which I gave an API to Event Rule and whenever motion is detected it will hit given API with the post or put method and send details in the request body.
    You create a rule: the motion detection event triggers "Do HTTP Request" action, http URL and request body of which can be defined by you in tune with your API  of your custom server.
    Nx Server: Motion detection -> "Do HTTP Request" action -> http  API request -> your custom server.

    That is exactly what I've described. Please, read the recent post and try to do step by step in Nx Desktop.
     
    0
  • Permanently deleted user

    Hi Andrey,

    I created a generic event and configured the 'http post' action with following HTTP content as below:

    {
        "name": {event.source},
        "description": {event.description}
    }
     
    This did not work. Can you help me in getting the post content correct?
     
    0
  • Andrey Terentyev
    • Network Optix team

    Hello vamsi krishna yesu ,

    If the problem still persists, could you share a screenshot of your configured rule?

    0
  • Permanently deleted user

    Hi Andrey,

    It works now. I have not made any changes as such. Were there any updates recently?

     

     

    0
  • Permanently deleted user

    Hi Vamsi,

    Andrey is currently on vacation, so I will be monitoring the forum instead of him for some time. It would be easier for me to answer your question if I knew which software version did you use when the issue was present and which version you're using now.

    Could you please share this info? Thank you.

     

    0
  • Permanently deleted user

    Hi Maxim,

    I had one version on windows (4.1.0.31398) and one in ubuntu(4.0.0.29987). None of the systems had never been updated as per the 'about info'.

    Now I am using ubuntu only. I shall get back in case of any issue.

    Please confirm if this feature works on above mentioned windows version too. 

     

    0
  • Andrey Terentyev
    • Network Optix team

    Hello Vamsi,

    > It works now. I have not made any changes as such. Were there any updates recently?
    No updates since the release.

    > I had one version on windows (4.1.0.31398) and one in ubuntu(4.0.0.29987).
    I'd recommend you upgrade to the latest v4.1 release.

    0

Please sign in to leave a comment.