Hello,
How do I create a Rule programmatically? I know that the SDK does not support it (see https://developer.milestonesys.com/s/question/0D53X00005upioUSAQ/2019-r2-sdk-config-api-additions-can-we-now-create-record-rules).
Looking at the database ([Surveillance].[dbo].[Rules]) we see the column Definition is plain XML like this:
f07ac0e3-9662-4781-9176-ec9e488aa494
<Region name="VideoOS.Always">
<Token type="Value" datatype="Boolean">True</Token>
</Region>
<Parameter name="State">On</Parameter>
<Parameter name="DeviceIds" />
<Parameter name="DeviceGroupIds">0e1b0ad3-f67c-4d5f-b792-4bd6c3cf52f8</Parameter>
<Parameter name="Delay">0</Parameter>
f07ac0e3-9662-4781-9176-ec9e488aa494
<Parameter name="State">Off</Parameter>
<Parameter name="DeviceIds" />
<Parameter name="DeviceGroupIds">0e1b0ad3-f67c-4d5f-b792-4bd6c3cf52f8</Parameter>
<Parameter name="Delay">0</Parameter>
This looks fairly easy to generate, basically we simply need to find all the GUIDs then insert a new entry in the table?
Please advice if there’s a better way.