Questions tagged [httpbuilder]

HTTPBuilder is a wrapper for Apache's HttpClient, with some (actually, a lot of) Groovy syntactical sugar thrown on top. The request/response model is also inspired by Prototype.js' Ajax.Request.

HTTPBuilder wraps Apache's HttpClient, with Groovy syntactical sugar thrown on top.

It handles common tasks such as building and parsing common content-types, handling common content-encodings, and built-in support for common authentication mechanisms. It works equally as well for simple REST-based requests, or ad-hoc web downloads.

The request/response model is inspired by Prototype.js's Ajax.Request.

206 questions
6
votes
1 answer

Grails REST Client Plugin - Specify Header Data

Latest version of the REST Client plugin for grails: withHttp(uri: "http://foo/bar") { def bodyContent = [ apiKey: "somekey", identifier: identity.identity, activity: ac as JSON ] def json =…
Gregg
  • 34,973
  • 19
  • 109
  • 214
6
votes
1 answer

Is Grails HTTPBuilder thread safe?

Is HTTPBuilder in Grails thread safe? If HTTPBuilder is wired to a Grails service class, will it be safe to use? Or should it be instantiated on every invocation? There doesn't seem to be any concrete answer as to whether HTTPBuilder in Grails is…
Thihara
  • 7,031
  • 2
  • 29
  • 56
5
votes
1 answer

HTTPBuilder set requestBody on GET method

Using cURL I can send a GET request with a body. Example: curl -i -X GET http://localhost:8081/myproject/someController/l2json -H "content-type: application/json" -d…
Mikey
  • 4,692
  • 10
  • 45
  • 73
5
votes
3 answers

HTTPBuilder and MultipartEntity / multipart form-data in Groovy

Trying to simulate a HTTP POST that needs to combine some INPUT/TEXT fields along with data from a file. It looks like I can have one or the other, but not both? In the snippet below, paramsToPost = [name: 'John', age:22]…
Sunny
  • 1,129
  • 4
  • 13
  • 25
5
votes
1 answer

NOT FOUND using restclient

My request looks like this but when I try to run this code I get this error: @Grab(group='org.codehaus.groovy.modules.httpbuilder',module='http-builder', version='0.7') import groovy.json.JsonOutput import groovy.json.JsonBuilder import…
pauleng
  • 69
  • 1
  • 5
5
votes
1 answer

Error in grabbing Grapes - Dependency not found

I have a Groovy file having following code : @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7' ) I am trying to download the dependencies to use HTTPBuilder. But it's showing me the error as follows…
Prashant2329
  • 327
  • 3
  • 7
  • 21
5
votes
2 answers

How to display HTTPBuilder logs in groovyConsole

The Problem I'm getting groovyx.net.http.HttpResponseException: Not Found and want to see the logs from HTTPBuilder. I'm using Groovy 2.1.9 with groovyConsole. What I tried So I checked this blog post that says about adding log4j.xml to…
user800014
5
votes
2 answers

groovy/grails - Can't make HTTPBuilder work with a URL (provided by Paypal)

PLEASE NOTE: With the code/info below, this problem can be reproduced in 2-3 minutes. BACKGROUND: Firstly I haven't found a plugin to help with the Paypal Advanced Interface (their mid-level solution between "Standard" and "Pro"), but if if I…
Ray
  • 5,885
  • 16
  • 61
  • 97
4
votes
1 answer

How to retrieve http get response as a complete json String in groovy using httpbuilder

I want to use the response json of a GET request as an input to another request. For that the response that I receive should be in correct json format. I am using HttpBuilder to do this. HTTPBuilder http = new HTTPBuilder(urlParam,…
user2239090
  • 61
  • 2
  • 4
4
votes
2 answers

How to set up a GET-Response in Groovy using HTTPBuilder

I have several issues stored in my YouTrack Server and I would like to extract those issues and pack the information in Strings. I already worked with the RESTClient, however I got bad output and thus want to try a different way to extract the…
blauerschluessel
  • 219
  • 1
  • 3
  • 14
4
votes
2 answers

Cannot install HTTPBuilder

I'm trying to install HTTPBuilder like this: @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.2') However, I'm getting this error: java.lang.RuntimeException: Error grabbing Grapes -- [download failed:…
zoran119
  • 10,657
  • 12
  • 46
  • 88
4
votes
1 answer

Is it safe to reuse Groovy HTTPBuilder objects for multiple requests?

I have some HTTPBuilder code that behaves differently depending on whether or not I reuse the same HTTPBuilder object to perform two different requests to the same REST service: def http = new HTTPBuilder( 'https://myBaseURI/' ) http.auth.basic…
SaucyWrong
  • 87
  • 2
  • 6
4
votes
1 answer

Groovy HTTPBuilder post file upload without multipart/form-data?

How do I perform an HTTP post in groovy using HTTPBuilder that uploads the raw bytes of a file without using multipart/form-data? Specifically, I want my request to look like this: POST http://.... Host: myhost Content-Length:…
user3915521
  • 41
  • 1
  • 2
4
votes
2 answers

Response from a POST request in Groovy RESTClient is missing data

I am using groovy RESTClient 0.6 to make a POST request. I expect an XML payload in the response. I have the following code: def restclient = new RESTClient('') def headers= ["Content-Type": "application/xml"] def body=…
The Governor
  • 1,152
  • 1
  • 12
  • 28
4
votes
1 answer

401 Unauthorized access for Github API using HttpBuilder (Groovy)

I wrote a Groovy script to manage some organization repos on Github. It was working great until several weeks ago, when the same script started failing. Maybe Github changed some aspect of their API? Or maybe I'm doing something stupid. I've…
1
2
3
13 14