Skip to content

Instantly share code, notes, and snippets.

@michaelrice
Created October 9, 2013 06:24
Show Gist options
  • Save michaelrice/6897024 to your computer and use it in GitHub Desktop.
Save michaelrice/6897024 to your computer and use it in GitHub Desktop.
jersey-request-builder syntax
def payload = new RequestBuilder().get {
ignoreInvalidSSL = true
accept = "application/json"
useBasicAuth = true
basicAuthUserName = grailsApplication.config.niftyApi.user
basicAuthPassword = grailsApplication.config.niftyApi.password
uri = "${grailsApplication.config.niftyApi.url}/action"
}
// need a put?
try{
new RequestBuilder().put {
ignoreInvalidSSL = true
uri = "https://my.niftyApi.com/api"
useBasicAuth = true
basicAuthUserName = grailsApplication.config.niftyApi.user
basicAuthPassword = grailsApplication.config.niftyApi.password
body = ["cdp": "disabled"]
}
}
catch(Exception e) {
handleException()
}
//POST and DELETE is also supported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment