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!
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", "m", "aug", "dim", "7", "m7", "maj7", "m7b5", "sus2", "sus4", "7sus4", "9", "11", "13", "6", "m6", "add9", "m9", "5", "dim7", "m13", "7sus2", "mMaj7", "m11" and "maj9".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" (G-tuning), "d-tuning" or "slack-key". Optional.lang language. Can be set to "fr" (french), "es" (spanish), "de" (german), "id" (indonesian), "ru" (russian) or "pt" (portuguese). Optional (English by default).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 infosReturns false if requested chord is not found.
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 class="lazy" src="/img/img_load.png" data-src="'. $res .'" alt="" width="90" height="130" />';
?>
Please contact us or visit our Facebook Page if you need help using our API.
