Created
October 9, 2013 06:24
-
-
Save michaelrice/6897024 to your computer and use it in GitHub Desktop.
jersey-request-builder syntax
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
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