Skip to content
A clojure wrapper for the Spotify web API
Clojure Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dev-resources
src/clj_spotify fixed persistent typo of 'maximum' being mispelled 'maxium' Dec 20, 2018
test
.gitignore
.travis.yml
LICENSE Adds MIT license. Sep 25, 2015
README.md
project.clj Bumps dependencies and version to 0.1.9 Dec 23, 2018

README.md

Build Status Clojars Coverage Status Dependencies Status Downloads

clj-spotify

clj-spotify is a client library for accessing the Spotify Web API. clj-spotify aims to be identical to Spotify's Web API when it comes to naming of endpoints, path elements and query parameters therefore the documentation found here is very short. Please read through the Spotify API Endpoint Reference, a one to one mapping from the endpoints to functions in this library should be possible.

Usage

Each function takes a map m of parameters and a sometimes optional oauth token t. Function names are the same as the names found in Spotify's API Endpoint Reference. A function call to retrieve a track from Spotify then has the function signature (get-a-track m t) and a function call to get an album's tracks has the function signature (get-an-albums-tracks m t) and so on.

map m

The map m holds both path elements and query parameters. Key names and value types in m are the same as those found in Spotify's API Endpoint Reference for path elements and query parameters. Integer values such as :limit and :offset can be specified either as integers or strings in m.

oauth token t

For a simple method to obtain an access token through the Client Credentials flow, use clj-spotify.util/get-access-token. If you need oauth2 authentication through the Authorization Code Flow (for example, to use endpoints which access private user information), see this blog post on how to roll your own: OAuth2 is easy - illustrated in 50 lines of Clojure.

Return values

clj-spotify returns the data received from the Spotify Web API unaltered but the response will be converted from json to a Clojure map.

Error handling

Error messages received from Spotify are returned unaltered as received from the servers. If an API call would result in an exception in clj-spotify this will be returned on the same format as Spotify's error messages but with the :status key set to Exceptionand the result of calling (.getMessage e) on the Exception e associated with the :message key.

Additional documentation

Each function has a basic doc string but if the usage still is unclear please consult Spotify's API Endpoint Reference.

License

The MIT License (MIT)

Copyright (c) 2017 Karl Blomström

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You can’t perform that action at this time.