Skip to content

Latest commit

 

History

History
47 lines (43 loc) · 833 Bytes

README.md

File metadata and controls

47 lines (43 loc) · 833 Bytes

Batching

Send batch request

Make multiple request to api in a single call

Official Documentation


const params = {
  requests: [
    {
      method: "POST",
      path:   "api/fields",
      body:   {
        name: "test batch field 1",
        type: "text"
      }
    },
    {
      method: "POST",
      path:   "api/fields",
      body:   {
        name: "test batch field 2",
        type: "text"
      }
    },
    {
      method: "GET",
      path:   "/api/forms/popup",
      body:   {
        filter: {
          name: "test popup"
        }
      }
    }
  ]
}

mailerlite.batches.send(params)
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    if (error.response) console.log(error.response.data);
  });