This is an easy implementation of the setlist.fm API for Node.js and React. To start right away enter the following lines to your command line:
npm install setlistfm-js --save
This wrapper covers the brand new API of setlist.fm. To use the API, you need an API key of setlist.fm. You can apply for an API key here: https://www.setlist.fm/settings/api (Please note that you need an setlist.fm account to procede)
One quick information before we start: The whole wrapper is written for a Promise based implementation. And another thing: The whole documentation for the API can be found here, so if you have any questions about allowed search parameters this is your destination: https://api.setlist.fm/docs/1.0/index.html#resources
Okay, enough said - let's code!
var setlistfmClient = new setlistfm({
key: "", // Insert your personal key here
format: "json", // "json" or "xml", defaults to "json"
language: "de", // defaults to "en"
});
setlistfmClient.getArtist("8538e728-ca0b-4321-b7e5-cff6565dd4c0")
.then(function(artist) {
// Returns the artist profile of Depeche Mode
})
.catch(function(error) {
// Returns error
});
setlistfmClient.getArtistSetlists("8538e728-ca0b-4321-b7e5-cff6565dd4c0", {
p: 1
})
.then(function(setlists) {
// Returns page one of all Depeche Mode setlists
})
.catch(function(error) {
// Returns error
});
setlistfmClient.getCity("2921466")
.then(function(city) {
// Returns city profile
})
.catch(function(error) {
// Returns error
});
setlistfmClient.searchArtists({
artistName: "Linkin Park"
})
.then(function(results) {
// Returns results of the search
})
.catch(function(error) {
// Returns error
});
setlistfmClient.searchCities({
name: "New York"
})
.then(function(results) {
// Returns results of the search
})
.catch(function(error) {
// Returns error
});
setlistfmClient.searchCountries()
.then(function(results) {
// Returns a list of available countries
})
.catch(function(error) {
// Returns error
});
setlistfmClient.searchSetlists({
artistName: "Linkin Park"
})
.then(function(results) {
// Returns matching setlists of Linkin Park
})
.catch(function(error) {
// Returns error
});
setlistfmClient.searchVenues({
name: "Gruenspan"
})
.then(function(results) {
// Returns results of the search
})
.catch(function(error) {
// Returns error
});
setlistfmClient.getSetlistByVersion("43596f23")
.then(function(setlist) {
// Returns version of setlist
})
.catch(function(error) {
// Returns error
});
setlistfmClient.getSetlist("53e493bd")
.then(function(setlist) {
// Returns setlist
})
.catch(function(error) {
// Returns error
});
setlistfmClient.getUser("terhuerne")
.then(function(user) {
// Returns my own setlist.fm profile ;)
})
.catch(function(error) {
// Returns error
});
setlistfmClient.getUserAttended("terhuerne", {
p: 1
})
.then(function(setlists) {
// Returns setlists of concerts that I have attended to
})
.catch(function(error) {
// Returns error
});
setlistfmClient.getUserEdited("terhuerne", {
p: 1
})
.then(function(setlists) {
// Returns setlists that a user has edited
})
.catch(function(error) {
// Returns error
});
setlistfmClient.getVenue("4bd78fbe")
.then(function(venue) {
// Returns venue
})
.catch(function(error) {
// Returns error
});
setlistfmClient.getVenueSetlists("4bd78fbe", {
p: 1
})
.then(function(setlists) {
// Returns setlists of concerts that have happened at the given venue
})
.catch(function(error) {
// Returns error
});