Recently came across the following Automation Rest API for managing Automation Rules. I am working to create a new Automation rule when a project is created. I have setup a Webhook that Posts to create the rule for the new project. I have another rule I want to do the same with, but that Automation rule use smart values. So when I try to use the Post Rest API to create it, it interprets the existing smart values as blanks. Is there anything that I can do to pass those particular smart values as literals? Tried various ideas from ASCII replacement and such, with no success. Would appreciate any insights others have done.
Without seeing both the specifics of your rule-to-create-a-rule, and the dynamic JSON to create the message for the target rule...
I hypothesize you are encountering a racetrack timing problem. The Send Web Request action is quite prone to this problem and it can "grab" the JSON for the message before it fully evaluates. Occasionally, this throws an error due to invalid JSON, and other times, it just gets null data for the smart values in the message. (The same thing can happen when using a dynamic URL for an endpoint call.)
One way to check for this cause is to create the dynamic JSON and store that in a created variable, perhaps named varJson. This will force full evaluation of the expression before the rule proceeds. Then, just use {{varJson}} as the message in the endpoint call. This approach also helps with debugging as the entire expression can be written to the log to check it.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.