Unable to Update Workflow via API

Hi,

Im trying to update a workflow through the Patch Method on the workflow. Here I have an empty workflow & I want to add nodes and connections in the workflow. Once I make the request I dont get the nodes & connections in the response as well as they dont get added in the workflow. Here are some of the screen shots.

API Calling
q72

Body Parameters

Response
q74

Is there any parameter or format I am missing? Thanks

To debug that you can use a page like: https://webhook.site/

If we take for example the “nodes” property. If you do it as in your example above, directly setting the value to something like [{}], the data will look like this when it gets received by the server:

Screenshot from 2020-09-15 20-07-52
So it is a string. What we however need is a JavaScript Array.

To get that, we have to change the parameter to an expression and then set it to something like:
{{ JSON.parse("[{}]") }}
The data received will then look like this:

Screenshot from 2020-09-15 20-09-24

That is now correct and should then work as expected. You have to do that for every parameter which is supposed to be a JavaScript-Array or Object.

1 Like

Thanks @jan :grinning:

I forgot to check the datatype passed earlier. Makes more sense passing a JavaScript Array. Now its working

Great to hear! Have fun!