You should enter all JSON fields separately, just as with the flat.
So enter status, warehouse and variants - but assign the variants as value the variable you defined.
Make sure the variants variable has an object as value so something like: {{ { "vendor": "najel", "replenishment": 1 } }}
Could you describe your whole workflow of what are you trying to achieve?
From the users perspective - so what page does he sees whats on it, how the data flows so that you eventually want to submit to the API and what you want with the results. Step by step please.
That is the only way I know how to send data from client-side to server-side. If there is a better way to send data to that 'object' post field please let me know.
I was just talking about the set variable variants and it’s value there should be the expression I gave you.
I'm very sorry but I just don't understand that sentence, this is quite complicated for me.
Step by step please
If you could return the favor and step by step explain me what to do, I would appreciate that.
Then it is very important that you replicate the same structure in the server action, so the easies way is to link the page and its form and import it:
Then you will see the form, with its nested structure, under $_POST
In your API Action, you can not bind the purchase-order with the define $_POST.purchase_order
Note I used underscore in the inputs name like purchase_order to avoid limiting of the names in $_POST to contain the minus sign. - but as the eventual assigning goes to the right purchase-order it should be all fine
I do think the UI can be somewhat simpler to achieve this, I would have never figured this out myself (also because it’s not in the docs afaik).
Also when I change the text input name to purchase_order[variant][vendor] for instance, the ID field of the text input is changed to inp_purchase_order[variant][vendor] even though before I have named the ID field to something else. So then I would have to rename it back to the old ID again. No big deal but might be relevant for you.
I have just 2 steps in my server action, both API calls. But the response of api1 should be inserted into api2. Api2 has the nested JSON talked about above.
The input data has the post variable mentioned earlier: {{$_POST.purchase_order}}
Now, how do I insert the response of api1 into one of the childs of {{$_POST.purchase_order}} of api2?
Just went through something similar, so perhaps this thread will help:
I was inserting from a db query instead of an api, but this might give you some ideas. I ended up opening the server action in the editor, and was able to enter in a nested array for an outbound api action.