Hi!
I’m trying to create a new Action for our app. I have created simple actions and triggers with success, but can’t create this one with ‘Line Items’ support.
This is the JSON required by our API. This is a simplified example:
{
"gross": "100",
"total": "121",
"name": "Adobe",
"lines": [
{
"sku": "",
"descr": "Corsair H60 120mm GAMING LGA1200",
"quantity": "1",
"price": "100.00000"
}
]
}
In the Input Designer, I created the generic fields and the line items fields:

In the API configuration tab, I have to Switch to ‘Code Mode’ because, as said, our API requires the json to come in the ‘data’ param, so I did this:
const options = {
url: 'https://myapp.cloud/api/expenses',
method: 'POST',
headers: {
'apikey': bundle.authData.apikey
},
params: {
'data': '{"name":"'+bundle.inputData.name+
'","gross":"'+bundle.inputData.gross+
'","total":"'+bundle.inputData.total+
'","lines":"'+bundle.inputData.lines+'"}'
}
}
Now if I “create a zap with this action’, I have tried with a single item/line…

...and using comma separated items like this:

...but it is not working as expected. I think the problem is in the “Code Mode” section, that requires the lines to be sent in other way.
My API log shows this as the received request:
JSON: {"name":"Peter","gross":"100","total":"121","lines":"[object Object]"}
How can I prepare the request to send the line items to my api server, inside a ‘data’ parameter?
Thanks!