// Add the new condition to the existing condition as a new "vars" object data.logic.forEach(logic => { if (logic.type === "field" && logic.ref === "18495f53-a5f0-4cf1-b8ab-097cfb608e99") { logic.actions[0].condition.vars.push(newCondition); } });
const logic = { data } output = logic; });
Then I am pushing this output using a POST API Request in Typeform using API Request (Beta) in Typeform. But when I want to trigger the output, its showing me all data structure divided and obviously I am getting a 405.
What I am trying to achieve is to send a new "logic" object to the form, adding the new condition with the email of the zap (apart from test@test.com):
Best answer by mathio-tf
]It is a bit hard to check your logic while I do not see the rest of the form, as refsin logic must match existing field refs.
Note: I think you can ignore this section, but below are the steps I used when trying to replicate the issue. At the time I overlooked the issue was with using incorrect method (POST instead of PUT). I am keeping it below anyway, in case someone has issues with creating logic via API.
Note: I think you can ignore this section, but below are the steps I used when trying to replicate the issue. At the time I overlooked the issue was with using incorrect method (POST instead of PUT). I am keeping it below anyway, in case someone has issues with creating logic via API.
Hi @mathio , thanks so much for your help! I’ve successfully added the PUT call using Zapier and the logic got updated accordingly.
However, this is not what I was trying to do, let me explain.
I want to add a new email in the condition logic everytime a user answers the form, so if that same user uses the form for the second time, I can redirect him to a specific step. Therefore, I can not use a PUT call with the same JSON everytime. I have to somehow add a new logic on top of the existing logic, and I dont know how to do it with PUT or POST.
I would need to do a GET and after a PUT + new email logic? Or theres any easier way?
I am afraid in this case you would need to do GET to retrieve current form definition, then update the logic part and make PUT request to update this. You can not update logic without sending the whole definition.