Created
November 20, 2013 20:20
-
-
Save lhammond/7570315 to your computer and use it in GitHub Desktop.
swagger-js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script language="javascript" type="text/javascript"> | |
$(document).ready(function() { | |
window.swagger = new SwaggerApi({url: ":9000/api-docs"}); | |
swagger.build(); | |
success = function(data) { | |
document.getElementById("mydata").innerHTML = data.content.data; | |
} | |
function createAccount() { | |
console.log(swagger.apis); | |
console.log(swagger.apis.user); | |
console.log(swagger.apis.user.createAccount); | |
var body = { | |
firstName: "bob", | |
lastName: "smith", | |
email: "bob@google.com"}; | |
console.log("about to send"); | |
swagger.apis.user.createAccount({body: JSON.stringify(body)}); | |
} | |
$("#create-account-button").click(function() { | |
createAccount(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment