Skip to content

Instantly share code, notes, and snippets.

@fehguy
Last active August 29, 2015 14:01
Show Gist options
  • Save fehguy/c100e957219336e5f3c0 to your computer and use it in GitHub Desktop.
Save fehguy/c100e957219336e5f3c0 to your computer and use it in GitHub Desktop.
Calling wordnik API
window.authorizations.add("api_key", new ApiKeyAuthorization("api_key", "YOUR_KEY", "header"));
var args = {word: "cat"};
wordnik = new SwaggerApi({
url: "https://api.wordnik.com/v4/resources.json",
success: function() {
if(wordnik.ready === true) {
wordnik.word.getDefinitions(args, function(data){
var definitions = data.obj; console.log(definitions[0].word);
for (var i = 0; i < definitions.length; i++) {
var definition = definitions[i];
console.log(definition);
}
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment