example-data.com
Menu
Browse docs and collections

Overview

songs / #226

Heartbreak Hotel

Component variants

Related

Request

curl example

curl -sS \
  "https://example-data.com/api/v1/songs/226" \
  -H "Accept: application/json"

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/songs/226"
);
const song = await res.json();

TypeScript example

// Download once: mkdir -p types && curl -o types/songs.d.ts https://example-data.com/types/songs.d.ts
import type { Song } from "./types/songs";

const res = await fetch(
  "https://example-data.com/api/v1/songs/226"
);
const song = (await res.json()) as Song;

Python example

import requests

res = requests.get(
    "https://example-data.com/api/v1/songs/226"
)
song = res.json()

Response

{
  "id": 226,
  "albumId": 22,
  "artistId": 9,
  "title": "Heartbreak Hotel",
  "slug": "heartbreak-hotel-226",
  "trackNumber": 1,
  "durationSeconds": 468,
  "isExplicit": false,
  "playCount": 7892398,
  "createdAt": "2022-06-15T22:58:07.719Z"
}