offline

My Record Collection

#api

Every record collector knows Discogs. It's the de facto standard for cataloging your vinyl collection. But what's even better is that they provide a free API1 to access your collection data. And since I'm already maintaining my collection there, why not use it to display my records on my website?

Getting the API Token

Getting an API token from Discogs is straightforward:

  1. Create a Discogs account (if you haven't already)
  2. Go to your Developer settings
  3. Generate a new token
  4. Copy it somewhere safe

That's it. No OAuth dance, no complicated app registration. Just a simple token. I like that.

The API Call

Here's the API endpoint I'm using to fetch my collection:

https://api.discogs.com/users/{username}/collection/folders/{folder_id}/releases?sort_order=desc&sort=added&page=1&per_page=150&token={token}

Replace:

The response gives you everything: cover art, release year, artist info - the whole package.

Implementation

I'm using this here in my Pico CMS with a simple plugin that can deal with external data and here is my collection of 60s and 70s Southern Gospel records from the Tri-State area of Tennessee, Kentucky and Virginia. I love the music and I love pulling Json from somewhere and turn it into XML (grinning face emoji). Well HTML is some sort of XML, so it's not that far fetch()ed, isn't it?

Sorry for that cringey end.


  1. https://www.discogs.com/developers 

Marcus Obst
Güterweg 89b
09474 Crottendorf
Germany

+49 37344 133407
info@marcus-obst.de