Skip to content

Instantly share code, notes, and snippets.

@spinitron
Last active January 4, 2019 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spinitron/fec82a90f1ae97440bbe2cca011c9e2d to your computer and use it in GitHub Desktop.
Save spinitron/fec82a90f1ae97440bbe2cca011c9e2d to your computer and use it in GitHub Desktop.
Spinitron v2 API suplemental endpoint for backwards compatibility

Spinitron v2 API backwards compatibility

This endpoint is suplemental to the Spinitron v2 API and provides an alternative to the POST /spins enpoint for compatibility with applications that need to present spin metadata as query parameters in the request URL.

Base URL

https://spinitron.com/api

Endpoint

/spin/create-v1

HTTP methods

Spinitron allows both GET and POST requests.

Authentication

As other v2 endpoints, you may authenticate by presenting the API key either using HTTP Bearer Authorization (preferred) or in the query parameter access-token.

Parameters

Param Description
access-token Station API key. String. Not required if you use HTTP bearer auth.
aw Artist name. String. Required.
sn Song title. String. Required.
sc Song composer. String. Optional.
sp Spin start time, i.e. timestamp. String. Optional. Current server time is used if parameter absent. Today is assumed if no date is not explicit in the value. Station time zone is assumed if zone is not explicit in the value.
sd Spin duration. Optional. Integer seconds.
dn Album title. String. Optional.
dl Genre. String. Optional.
dr Release year. Integer. Year, e.g. 1999.
ln Record label name. String. Optional.

Examples

You may copy-paste the following URL into a web browser and substitute the station API key

https://spinitron.com/api/spin/create-v1?access-token=STATION_API_KEY&aw=ARTIST_NAME&sn=SONG_TITLE&sc=SONG_COMPOSER&sp=2:34:56&sd=120&dn=ALBUM_TITLE&dl=GENRE&dr=2011&ln=LABEL_NAME

Minimal example

https://spinitron.com/api/spin/create-v1?access-token=STATION_API_KEY&aw=X&sn=Y

Eample using HTTP Bearer Authorization

curl -i -H 'Authorization: Bearer STATION_API_KEY' \
'https://spinitron.com/api/spin/create-v1?aw=ARTIST_NAME&sn=SONG_TITLE&sc=SONG_COMPOSER&sp=2:34:56&sd=120&dn=ALBUM_TITLE&dl=GENRE&dr=2011&ln=LABEL_NAME'

Minimal example

curl -i -H 'Authorization: Bearer STATION_API_KEY' 'https://spinitron.com/api/spin/create-v1?aw=X&sn=Y'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment