- Core API's
- >
- Categories API
- >
- Categories - Create
Categories - Create API
Create a new Category.
Method POST
Body
{
"name": "Sample Category",
"description": "This is a sample category description."
}
How to Use
fetch('https://simplecrudapi.com/api/categories', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'name': 'Education',
'description': 'Resources and information for lifelong learning.'
})
})
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error(error));
Response
{
"data": {
"id": 1,
"name": "Education",
"description": "Resources and information for lifelong learning."
}
}
Try Now
fetch('https://simplecrudapi.com/api/categories', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'name': 'Education',
'description': 'Resources and information for lifelong learning.'
})
})
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error(error));