- Core API's
- >
- Todos API Documentation
Todos API Documentation
A Simple to use CRUD API for your Todos application. This API is ready to use with any frontend/backend framework or language.
Endpoints
| Name | Endpoint | Method | Copy |
|---|---|---|---|
| Todo List | /api/todos | GET | |
| Todo Detail | /api/todos/1 | GET | |
| Todo Create | /api/todos | POST | |
| Todo Update | /api/todos/1 | PUT | |
| Todo Delete | /api/todos/1 | DELETE |
How to Use
Todo List API
fetch('https://simplecrudapi.com/api/todos')
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error(error));
Todo Detail API
fetch('https://simplecrudapi.com/api/todos/1')
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error(error));
Todo Create API
fetch('https://simplecrudapi.com/api/todos', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Sample Todo',
description: 'This is a sample todo item',
user_id: '',
completed: ''
})
})
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error('Error posting data:', error));
Todo Update API
fetch('https://simplecrudapi.com/api/todos/1', {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: '',
description: '',
completed: '',
user_id: ''
})
})
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error('Error updating data:', error));
Todo Delete API
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));