Enable / Disable Mobile notification rule via API issue
AnsweredWhen creating an event rule. I have setup using the following guide.
How to Enable/Disable Analytic Rules via the Nx Meta Server API (nxvms.com)
I have setup the event rules identical. The only part of the http content that is changed is the variable from "false" to "true". If I run the Generic event I can get the Mobile notification rule to disable but when I run the generic event to then re-enable the rule this doesn't seem to work.
I can provide the HTTP content & Generic event strings/urls used if needed.
Thanks
NX Witness Information:
- Nx Witness Version: 5.1.0.37133
- Client OS: Edition
Windows 10 Pro
Version 22H2
Installed on 01/11/2022
OS build 19045.3448
Experience Windows Feature Experience Pack 1000.19044.1000.0 - Server OS: 5.1.0.37133
- Network Topology: 1 Server, 1 Switch, 5 Cameras, 1 PC Client, 1 Mobile App
- Special features: N/A
-
Hi Andrey,
Information updated for software versions etc…
Attached code used:
(Fails enable rule)
{
"actionParams": "{\"additionalResources\":[\"{00000000-0000-0000-0000-100000000000}\",\"{00000000-0000-0000-0000-100000000001}\"],\"allUsers\":false,\"authType\":\"authBasicAndDigest\",\"durationMs\":5000,\"forced\":true,\"fps\":10,\"needConfirmation\":false,\"playToClient\":true,\"recordAfter\":0,\"recordBeforeMs\":1000,\"streamQuality\":\"highest\",\"useSource\":true}",
"actionResourceIds": [],
"actionType": "pushNotificationAction",
"aggregationPeriod": 0,
"comment": "Mobile App Cam 04",
"disabled": false,
"eventCondition": "{\"analyticsEngineId\":\"{9537fc21-e0b1-3ca8-424f-385cf4e9a45a}\",\"eventTimestampUsec\":\"0\",\"eventType\":\"undefinedEvent\",\"inputPortId\":\"nx.openvino_object_detection.areaEntranceDetected\",\"metadata\":{\"allUsers\":false,\"level\":\"\"},\"omitDbLogging\":false,\"progress\":0,\"reasonCode\":\"none\"}",
"eventResourceIds": [
"{28ad2da1-6101-563e-f416-16881ca47591}"
],
"eventState": "Undefined",
"eventType": "analyticsSdkEvent",
"id": "{1e91c869-d794-44de-a10f-d40af1b456cc}",
"schedule": "",
"system": false
}(This rule disabled works correctly)
disabled:
{
"actionParams": "{\"additionalResources\":[\"{00000000-0000-0000-0000-100000000000}\",\"{00000000-0000-0000-0000-100000000001}\"],\"allUsers\":false,\"authType\":\"authBasicAndDigest\",\"durationMs\":5000,\"forced\":true,\"fps\":10,\"needConfirmation\":false,\"playToClient\":true,\"recordAfter\":0,\"recordBeforeMs\":1000,\"streamQuality\":\"highest\",\"useSource\":true}",
"actionResourceIds": [],
"actionType": "pushNotificationAction",
"aggregationPeriod": 0,
"comment": "Mobile App Cam 04",
"disabled": true,
"eventCondition": "{\"analyticsEngineId\":\"{9537fc21-e0b1-3ca8-424f-385cf4e9a45a}\",\"eventTimestampUsec\":\"0\",\"eventType\":\"undefinedEvent\",\"inputPortId\":\"nx.openvino_object_detection.areaEntranceDetected\",\"metadata\":{\"allUsers\":false,\"level\":\"\"},\"omitDbLogging\":false,\"progress\":0,\"reasonCode\":\"none\"}",
"eventResourceIds": [
"{28ad2da1-6101-563e-f416-16881ca47591}"
],
"eventState": "Undefined",
"eventType": "analyticsSdkEvent",
"id": "{1e91c869-d794-44de-a10f-d40af1b456cc}",
"schedule": "",
"system": false
}I can manually call the API via a browser session and can see NX picking it up as I get a notification on the client weather its enabled or disabled.
-
Hi Andrew,
I have given this ago. The problem is still present. I can disable the rule with no issue based on the updated JSON template you provided above. Enabling does not seem to work. Everything is identical apart from the variable where ("disabled": false) is used.
Any idea?
This works:
{
"id": "1e91c869-d794-44de-a10f-d40af1b456cc",
"disabled": true
}
This doesn't work:
{
"id": "1e91c869-d794-44de-a10f-d40af1b456cc",
"disabled": false
}
-
Hi Andrew,
I amended to the rule to "write to log" and can confirm my "Enable" trigger event is working correctly. As soon as I change this back to enable the camera rule. This still fails to work. I'm quite sure my enable trigger method isn't at fault here.
What do you suggest I could try next?
-
Hmmm...Interesting.
I don't work for Nx, but I am intrigued by the issue.I'm happy to cast my eye over your system prior to you raising a support ticket via your nx distributor.You can email me privately at nx@nfs.co.nz and we can arrange some sort of remote session. -
I can successfully enable the rule via a soft trigger with no issue there, like your example above!
I can't exactly pinpoint where this is breaking as its pretty much identical to my disable API call / rule which works. Its likely that I have missed something small which I just cannot see ;)
My URL API call is as followed: XXX.XXX.XXX.XXX:7001/api/createEvent?source=Analytic+Enabled+&caption=Analytic+Enabled&description=Analytic+Enabled
-
Since the soft trigger works, it is definately your generic event.
The rules engine works sequentially & matches any keywords - seperated by spaces. My bet is the "disable" event rule is after the "enable" event rule, therefore is also triggering, i.e. both rules are matching in sequence on the word "Analytic".
Use an underscore "_" instead of space for the keyword (everywhere) to create an exact match.
I.e. Analytic_EnableRegards,
Andy ;-) -
Hi Andy,
I tried tried using an underscore and this didn't work for both enabling & disabling. I did try to break it up as I have a feeling you were on the right track where the rule was disabling after enabling. If I were to refresh the URL is would randomly work and then stop.
My solution to breaking it up is by doing the following and seems to be working each time. :)
Please sign in to leave a comment.
Comments
11 comments