Как отправить массив объектов в Zapier UI Builder - PullRequest
0 голосов
/ 03 апреля 2019

Я пытаюсь отправить массив объектов в конечную точку API с помощью Zapier и не могу правильно отформатировать мои данные.Ниже показано, что ожидает конечная точка

[{
        "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

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;
  });
...