Skip to main content

Hello,

I am currently working on an APP in Zapier, where I created a module to POST the data to the API.

I have this example structure how should the body parameters send to the endpoint:

 

 { 

"orderNumber": "ABC-123-456",
"shopToken": "SHOP1",
"language": "de",
"customerNumber": "654321",
"shippingAddress": {
"firstName": "Test",
"lastName": "Test",
"street": "Main Street",
"streetNumber": "17a",
"city": "Test",
"postalCode": "12345",
"country": "DE",
"email": "user@example.com",
"addition3": "string",
"addition2": "string",
"addition1": "string",
"department": "Marketing",
"company": "Test GMBH",
"salutation": "Herr"
},
"billingAddress": {
"firstName": "Test",
"lastName": "Test",
"street": "Main Street",
"streetNumber": "17a",
"city": "Test",
"postalCode": "12345",
"country": "DE",
"email": "user@example.com",
"addition3": "string",
"addition2": "string",
"addition1": "string",
"department": "Marketing",
"company": "Test GMBH",
"salutation": "Herr"
},
.

I am using in the Zapier Platfrom UI to build the modules where I have add the line item group called shippingAddress and the other called billingAddres.

 

const options = {
url: 'https://api.paqato.com/v3/orders',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
params: {
'token': bundle.inputData.token,
},
body: {
'orderNumber': bundle.inputData.orderNumber,
'shopToken': bundle.inputData.shopToken,
'language': bundle.inputData.language,
'customerNumber': bundle.inputData.customerNumber,
'shippingAddress': bundle.inputData.shippingAddress,
'billingAddress': bundle.inputData.billingAddress
}
}

return z.request(options)
.then((response) => {
// trying to see log the input, but they don't show in Zapier UI console.
console.log(bundle.inputData);
response.throwForStatus();
const results = response.json;
return results;
});


However, I am sending in this way the body parameters, but the API response with the message that parameters shippingAddress.firstName… is missing.


Is this the right way how I am sending the parameter like Shipping Address which is Line Item Group and contains the information like FirstName, LastName etc?

Is there any way that I can view the Request Parameters in Zapier UI (Web Builder)?

Looking forward to your help/advice!

Currently ZAPIER Platform UI isn’t rendering the Line Items Group as nested/collection like it said in documentation.

I have find a solution till this it will be fixed in the future:
Instead to get the access of fields like a line items, I can access directly and add to an object parameter:


const shippingAddress = {};
shippingAddresss"lastName"] = bundle.inputData.lastName;
shippingAddresss"street"] = bundle.inputData.street;
shippingAddresss"city"] = bundle.inputData.city;
shippingAddresss"postalCode"] = bundle.inputData.postalCode;
shippingAddresss"country"] = bundle.inputData.country;

// in the options I add then
const options = {
....
body: {

...,
'shippingAddress': shippingAddress,
}
}