如何在Zapier UI构建器中发送对象数组

时间:2019-04-03 06:04:38

标签: javascript json zapier

我正在尝试使用Zapier将对象数组发送到API端点,但似乎无法正确格式化我的数据。以下是端点的期望

[{
        "date": "2014-02-13",
        "do": "DO140213001",
        "address": "63 Ubi Avenue 1 Singapore 408937"
    },
    {
        "date": "2014-02-13",
        "do": "DO140213002",
        "address": "59 Ubi Avenue 1 Singapore 408938",
        "delivery_time": "02:00 PM - 05:30 PM"
    }
]

这是我在Zapier UI Web构建器中拥有的

const options = {
  url: 'https://app.detrack.com/api/v1/deliveries/update.json',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'X-API-KEY': bundle.authData.api_key
  },
  params: {

  },
  body:  [{
  }]
};
return z.request(options)
  .then((response) => {
    response.throwForStatus();
    const results = z.JSON.parse(response.content);

    // You can do any parsing you need for results here before returning them

    return results;
  });

0 个答案:

没有答案