Skip to content
ID: createArtist

Add a new artist

POST
/api/v1/artists

Add a new legendary Argentine Rock artist. Make sure they truly deserve the title!

Authorizations

Request Body

JSON
{
"id": 1,
"name": "Charly García",
"description": "One of the most influential rock musicians in Argentine history.",
"image": "https://cdn.rock-legends.com/photos/charly.jpg",
"band": "Sui Generis"
}

Responses

Created
JSON
{
"id": 1,
"name": "Charly García",
"description": "One of the most influential rock musicians in Argentine history.",
"image": "https://cdn.rock-legends.com/photos/charly.jpg",
"band": "Sui Generis"
}

Samples

Bruno
post {
  url: https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists
}

headers {
  Content-Type: application/json
}

body {
  {
    "id": 1,
    "name": "Charly García",
    "description": "One of the most influential rock musicians in Argentine history.",
    "image": "https://cdn.rock-legends.com/photos/charly.jpg",
    "band": "Sui Generis"
  }
}
Bruno
post {
  url: https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists
}

headers {
  Content-Type: application/json
}

body {
  {
    "id": 1,
    "name": "Charly García",
    "description": "One of the most influential rock musicians in Argentine history.",
    "image": "https://cdn.rock-legends.com/photos/charly.jpg",
    "band": "Sui Generis"
  }
}
cURL
curl -X POST \
'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists' \
 -H "Content-Type: application/json" \
 --data '{
  "id": 1,
  "name": "Charly García",
  "description": "One of the most influential rock musicians in Argentine history.",
  "image": "https://cdn.rock-legends.com/photos/charly.jpg",
  "band": "Sui Generis"
}'
JavaScript
fetch('https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists', {method:'POST',headers:{'Content-Type':'application/json'},body:'{"id":1,"name":"Charly García","description":"One of the most influential rock musicians in Argentine history.","image":"https://cdn.rock-legends.com/photos/charly.jpg","band":"Sui Generis"}'})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists';
$method = 'POST';
$headers = [
    'Content-Type' => 'application/json',
];
$body = json_encode({"id":1,"name":"Charly García","description":"One of the most influential rock musicians in Argentine history.","image":"https://cdn.rock-legends.com/photos/charly.jpg","band":"Sui Generis"});

$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'

headers = {
    'Content-Type': 'application/json'
}
data = {
    'id': 1,
    'name': 'Charly García',
    'description': 'One of the most influential rock musicians in Argentine history.',
    'image': 'https://cdn.rock-legends.com/photos/charly.jpg',
    'band': 'Sui Generis'
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
Powered by VitePress OpenAPI