Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kyyberi
Created January 4, 2016 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyyberi/793d2570282eb1b6f4a6 to your computer and use it in GitHub Desktop.
Save kyyberi/793d2570282eb1b6f4a6 to your computer and use it in GitHub Desktop.
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
$(document).ready(function(){
$.ajax({
type: "GET",
url: "https://apis-guru.github.io/api-models/apis.json",
dataType: 'json',
cache: false,
success: function(data)
{
// alert(data);
var ocount = data.apis.length;
var urlout = "";
$("#ocount").append(ocount);
$.each(data.apis, function (i, api) {
// tee mitä haluat jokaiselle
var shortText = jQuery.trim(api.description).substring(0, 200)+"...";
if(api.hasOwnProperty('image')){
var imageurl = jQuery.trim(api.image);
}else{
var imageurl = "http://dreampirate.in.th/img/noAvatar.png?1392177846";
}
$("#list").append("<div><span>"+api.name+" (version "+api.version+")</span><p style='width:100px;max-height:150px;margin-right:10px;border:none;' class='imagelogo'><img style='border:none;' src='"+imageurl+"'/></p><p>"+shortText+"</p><p><b>API Swagger 2.0 spec:</b><br/> <a href='"+api.properties[0].url+"'>"+api.properties[0].url+"</a></p><p><b>API Backend:</b><br/> <a href='"+api.baseUrl+"'>"+api.baseUrl+"</a></p></div>");
});
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment