How do I use the RESTful playlist API?


The easiest way to interact with the API is to simply type a URL into your browser, or click this link:

 

http://live1.brownrice.com/api/kbac/20150303/xml

 

The API will accept up to four parameters:

 

  • Station name
  • Date stamp
  • Output Format
  • Error switch

 

The only required parameter is Station Name (e.g kbac). If the date stamp is omitted, the API will return playlist data for today's date. The default format is XML, but you could also specify JSON. The API will include potentially helpful usage information and debugging messages as part of the output format. You can switch off this behavior by adding /noerrors to the URL. It does not matter in what order you specify the query parameters in the URL. Below are some example URLs to illustrate:

 

 
 
If a malformed date stamp (not exactly 8 digits, YYYYMMDD) is supplied, like this:
http://live1.brownrice.com/api/201411/kvsf
 
The API will default to today's date, AND produce a debugging message to let you know about proper date stamp formatting.

 

If you do not supply a station name, or supply an invalid station name, the API will ONLY return an error, which includes a list of valid station names, pulled straight from the database.

 

We've put together some example code to help you get started. This example will call up a specific date from the API, parse the XML generated by the API, and convert it into HTML. It also takes advantage of the iTunes API URL included in the XML output to query the iTunes API for cover art, and a link to buy the track on iTunes.

 

 

Enjoy!

Records in this category

    Sticky FAQs