ID: createAlbum
Add a new album
POST
/api/v1/artists/{artistId}/albumsAdd a new album to a legendary Argentine Rock artist. Make sure it’s a masterpiece!
Authorizations
Parameters
Path Parameters
artistId*
Typeinteger
RequiredExample
1
Request Body
JSON
{
"id": 1,
"name": "La Máquina de Hacer Pájaros",
"year": 1976,
"image": "https://cdn.rock-legends.com/photos/la-maquina.jpg"
}
Responses
Created
JSON
{
"id": 1,
"name": "La Máquina de Hacer Pájaros",
"year": 1976,
"image": "https://cdn.rock-legends.com/photos/la-maquina.jpg"
}
POST
/api/v1/artists/{artistId}/albumsSamples
Bruno
post {
url: https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums
}
headers {
Content-Type: application/json
}
body {
{
"id": 1,
"name": "La Máquina de Hacer Pájaros",
"year": 1976,
"image": "https://cdn.rock-legends.com/photos/la-maquina.jpg"
}
}
Bruno
post {
url: https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums
}
headers {
Content-Type: application/json
}
body {
{
"id": 1,
"name": "La Máquina de Hacer Pájaros",
"year": 1976,
"image": "https://cdn.rock-legends.com/photos/la-maquina.jpg"
}
}
cURL
curl -X POST \
'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums' \
-H "Content-Type: application/json" \
--data '{
"id": 1,
"name": "La Máquina de Hacer Pájaros",
"year": 1976,
"image": "https://cdn.rock-legends.com/photos/la-maquina.jpg"
}'
JavaScript
fetch('https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums', {method:'POST',headers:{'Content-Type':'application/json'},body:'{"id":1,"name":"La Máquina de Hacer Pájaros","year":1976,"image":"https://cdn.rock-legends.com/photos/la-maquina.jpg"}'})
.then(response => response.json())
.then(data => console.log(data));
PHP
<?php
$url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums';
$method = 'POST';
$headers = [
'Content-Type' => 'application/json',
];
$body = json_encode({"id":1,"name":"La Máquina de Hacer Pájaros","year":1976,"image":"https://cdn.rock-legends.com/photos/la-maquina.jpg"});
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
Python
import requests
url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums'
headers = {
'Content-Type': 'application/json'
}
data = {
'id': 1,
'name': 'La Máquina de Hacer Pájaros',
'year': 1976,
'image': 'https://cdn.rock-legends.com/photos/la-maquina.jpg'
}
response = requests.post(url, headers=headers, json=data)
print(response.json())