- Core API's
- >
- Todos API
- >
- Todos - Delete
Todos - Delete API
Delete the specified Todo.
Method DELETE
Parameters
Name | Details | Type | Required |
---|---|---|---|
id
|
The ID of the Todo. | integer | Yes |
How to Use
fetch('https://simplecrudapi.com/api/todos/1', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error('Error deleting data:', error));
Response
{
"data": {
"id": 1,
"title": "Sample Todo",
"description": "This is a sample todo item",
"completed": true,
"user": {
"id": 1,
"name": "Jhon Doe",
"email": "jhondoe@example.com",
"email_verified_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
}
Try Now
fetch('https://simplecrudapi.com/api/todos/1', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error('Error deleting data:', error));