Skip to content

Instantly share code, notes, and snippets.

@nfabian13
Created April 21, 2015 14:50
Show Gist options
  • Save nfabian13/e261e15d097d73a01bf9 to your computer and use it in GitHub Desktop.
Save nfabian13/e261e15d097d73a01bf9 to your computer and use it in GitHub Desktop.
an example how to call the wordnik API using swagger.
<script src="~/lib/swagger-client.js" type='text/javascript'></script>
<script type="text/javascript">
$(document).ready(function () {
// initialize swagger, point to a resource listing
window.swagger = new SwaggerClient({
url: "http://api.wordnik.com/v4/resources.json",
success: function () {
swagger.apis.account.getLoggedInUser({username: 'myusername', password: 'mypass'}, function(data){
alert(data);
//document.getElementById("mydata").innerHTML = JSON.stringify(data.obj);
});
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment