The post example from the docs does not function with http-builder 1.7.1.
def msg = "I'm using HTTPBuilder's RESTClient on ${new Date()}"
def resp = twitter.post(
path : 'update.json',
body : [ status:msg, source:'httpbuilder' ],
requestContentType : URLENC )
assert resp.status == 200
assert resp.headers.Status
assert resp.data.text == msg
def postID = resp.data.id
The exception is
wslite.rest.RESTClientException: No such property: body for class: wslite.http.HTTPRequest
Trolling the API, it is not obvious how you are supposed to construct the post correctly. Any ideas?
Based on the exception it looks like you are using the groovy-wslite library and not HTTPBuilder. If that is the case, the following should work:
def resp = twitter.post(path: 'update.json') {
urlenc status: msg, source:'httpbuilder'
}