Skip to main content

Delete a component

Log in to add to favourites

Deletes a component from a specific project.

delete(id: string): Promise<void>

Returns

A Promise that will resolve with an empty object.

Example

JavaScript
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.

JSON
{
    "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"
}

Still need help?

If you still need help after reading this article, don't hesitate to reach out to the Contensis community on Slack or raise a support ticket to get help from our team.
New support request