- Core API's
- >
- Albums API
- >
- Albums - Create
Albums - Create API
Create a new Album.
Method POST
Body
{
"title": "Sample Album Title",
"user_id": 1
}
How to Use
fetch('https://simplecrudapi.com/api/albums', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'title': 'Greatest Hits',
'description': 'A compilation of the most popular tracks.',
'release_date': '2024-11-10'
})
})
.then(response => response.json())
.then(data => console.log(data)})
.catch(error => console.error(error)});
Response
{
"data": {
"id": 1,
"title": "The Greatest Hits",
"description": "A collection of the best songs from the 90s.",
"release_date": "1999-11-09"
}
}
Try Now
fetch('https://simplecrudapi.com/api/albums', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'title': 'Greatest Hits',
'description': 'A compilation of the most popular tracks.',
'release_date': '2024-11-10'
})
})
.then(response => response.json())
.then(data => console.log(data)})
.catch(error => console.error(error)});