Skip to content

Instantly share code, notes, and snippets.

@timhodson
Created February 21, 2012 11:08
Show Gist options
  • Select an option

  • Save timhodson/1875891 to your computer and use it in GitHub Desktop.

Select an option

Save timhodson/1875891 to your computer and use it in GitHub Desktop.
Kasabi: Quick example of using the Attribution API
#############################################
## Quick and dirty curl
#############################################
# Get a snippet of javascript
curl -v -X GET "http://api.kasabi.com/dataset/nasa/attribution"
# Get the attribution as JSON
curl -v -X GET "http://api.kasabi.com/dataset/nasa/attribution?output=json"
#############################################
## Javascript snippets for your HTML pages
#############################################
# Either add the following <script> tag to your HTML page where you want the attribution to appear
<script type="text/javascript" src="http://api.kasabi.com/dataset/nasa/attribution"></script>
# Or use jQuery to get the attribution text and display it in your own markup
$('document').ready(function() {
$.ajax({
url: "http://api.kasabi.com/dataset/nasa/attribution?output=json",
success: function(data) {
$('.myAttributionClass').html("Data from the <a href=\"" + data['homepage'] + "\"\ntitle=\"" + data['name'] + "\"><b>" + data['name'] + "</b> dataset</a> \nProvided by: <a href=\"" + data['source'] + "\">Kasabi</a>");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment