API

Advertisement

Free API for webmasters

Our API allows webmasters to easily query our chord database and to publish our diagrams (and more) onto their website. All you need is a valid API key (+ a link back to https://ukulele-chords.com), get one for free!

How does it work?

Here is how to access ukulele-chords.com's data

  • API URL : ukulele-chords.com/get?
  • Parameters : "ak" (your API key), "r" (root note of a chord), "typ" (chord type), "sk" (slashed chord) and "uke" (Tuning)
  • All parameters are compulsory except "sk" and "uke"
  • r is the root note of the chord. Can be set to "A", "Bb", "B" , "C", "Db", "D", "Eb", "E", "F", "Gb", "G" and "Ab"
  • typ is the type of chord. Can be set to "major, "minor", "aug, "dim", "7", "m7", "maj7", "m7b5", "sus2", "sus4", "7sus4", "6", "m6", "add9", "m9", "9", "11", "13"
  • sk is the altered root note of a slashed chord. Optional. (Accepted values : see "r")
  • uke is the tuning. Can be set to "soprano" (default value), "baritone", "d-tuning" or "slack-key". Optional.
  • Example: to query Csus2 chord infos, call our API: "http://ukulele-chords.com/get?ak=your_api_key&r=C&typ=sus2"

Output (XML format)

  • chord_name The chord name...
  • chord_diff Difficulty (on 10)
  • chord_diag Chord diagram (200x250)
  • chord_diag_mini Chord diagram (90x130)
  • chord_photo Picture (returns "false" if we don't have the photo)
  • chord_url Link to Ukulele-chords.com for more infos

Returns false if requested chord is not found.

Working PHP example

Not sure about how to use our API? Here is a working example to get a 'C Major' chord diagram, using the SimpleXML extension (native since PHP 5.0):

<?php
//XML file to load
$api_url 'http://www.ukulele-chords.com/get?ak=YOUR_API_KEY&r=C&typ=major';
//converts the specified XML file into a SimpleXMLElement object
$xml simplexml_load_file($api_url);
//Navigate through the tree to get your info (chord diagram here)
//chord[0] returns the "main chord". For alternative positions, use a foreach() loop.
$res $xml->chord[0]->chord_diag_mini;
//print the result
echo '<img src="'$res .'" alt="" width="90" height="130" />';
?>

Please visit our Facebook Page if you need help using our API.


© 2011-2017 Ukulele-chords.com