Skip to content

Latest commit

 

History

History
77 lines (64 loc) · 1.51 KB

README.md

File metadata and controls

77 lines (64 loc) · 1.51 KB

Fields

List all fields

Official Documentation


const params = {
  limit: 5,
  page: 1,
  filter: {
    type: "text", // text, number, date
  },
  sort: "name" // name, -name, type, -type
}

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

Create a field

Official Documentation


const params = {
  name: 'Test field',
  type: 'text' // text, number, date
}

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

Update a field

Official Documentation


const params = {
  name: "Updated field name"
};

mailerlite.fields.update("FIELD_ID", params)
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    if (error.response) console.log(error.response.data);
  });

Delete a field

Official Documentation


mailerlite.fields.delete("FIELD_ID")
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    if (error.response) console.log(error.response.data);
  });