I’m trying to automate some adding some rules to folder however I’m experiencing issues that I can’t explain and fix and documentation is extremely vague. I’m trying to add this rule automatically via API:
The result of your first “get_ruleset” looks like that there is nothing set at the moment. I’m correct?
If you sent without configuration hash, the new rule should be created without internal checking.
I would check after the “get_ruleset” if my “ruleset” dictionary is empty, and then decide if i must sent a configuration hash or not.
@andreas-doehler You’re right. There was no rule in this folder. I removed config_hash from the end and this executed fine.
So to make it clear, configuration_hash should be used when the rule already exist but I want to modify it right ?
Yes, if i remember it correctly then the configuration hash is used by the system to check if something is changed or not. Your hash is a hash of a empty rule, i think there could be a logic problem if the existing rule is empty
The configuration_hash has to be put outside the rule_set dict when posting. You mixed the position of a }. Instead of two }} after configuration_hash put one before the comma in front of configuration_hash.