In this tutorial, I'm going to walk you through embedding Phish.net setlists into a website using javascript. For this tutorial, I'll be using version 3 of the Phish.net API. Using the setlists.latest method, you can fetch the latest setlist.
Believe it or not, this so simple, it will take you fewer than 10 seconds to add to your site. As we covered, for now, assume we're trying to embed the latest setlist in the sidebar of your site. The sidebar might look like this:
<div class='sidebar'></div>
Or, if you're cutting edge, maybe like this:
<aside></aside>
Are you ready to embed the latest setlists? This is all we have to add, in between div or aside tags:
<script src="https://api.phish.net/v3/setlists/latest?apikey=<APIKEY>&callback=phishnet.setlist"></script>
That's it. Everything should work as-is. But what's actually happening?
Part of that script is defining a function, a function we call a "callback" function, because we'll call on the data we get back. While the API is fetching the data, the callback function, is parsing it and wrapping it HTML and writing it to the browser window. Add that line to your website, insert your API key, and - boom! - the latest setlist will be on your website. Check out the API documentation for more.
Phish.net is a non-commercial project run by Phish fans and for Phish fans under the auspices of the all-volunteer, non-profit Mockingbird Foundation.
This project serves to compile, preserve, and protect encyclopedic information about Phish and their music.
Credits | Terms Of Use | Legal | DMCA
The Mockingbird Foundation is a non-profit organization founded by Phish fans in 1996 to generate charitable proceeds from the Phish community.
And since we're entirely volunteer – with no office, salaries, or paid staff – administrative costs are less than 2% of revenues! So far, we've distributed over $2 million to support music education for children – hundreds of grants in all 50 states, with more on the way.