Skip to main content
Browse Documentation

Delete a component

Created by Alex Pop on 19 Dec 2019

Deletes a component from a specific project.

delete(id: string): Promise<void>

Returns

A Promise that will resolve with an empty object.

Example

client.components.delete('address')
  .then(result => {      
    console.log('API call result: ', result);              
  })
  .catch(error => {
    console.log('API call fetch error: ', error);      
});

Validations

Deleting a component which is in use

If a component is in use within a content type then it can't be deleted. If you attempt to delete a component which is in use you will get the following response.

{
    "logId": "6eda131e-c8eb-44dc-8665-ae3a8b1815d8",
    "message": "There are validation errors deleting the component",
    "data": [
        {
            "field": "",
            "message": "The component cannot be deleted as it is in use in one or more content types"
        }
    ],
    "type": "Validation"
}