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
2
votes
1 answer

Google QPX API post with JSON return "HTTP/1.1 403 Forbidden" on Groovy

i m not able to consume Google rest API in groovy. I m newbie with groovy :S and i m using HTTPBuilder to ask the service. My code is: public static void testJSONPost() { def builder = new…
paulofer85
  • 555
  • 11
  • 15
2
votes
1 answer

groovy httpBuilder with proxy (and auth)

I'm trying to use httpBuilder to connect to a webservice using a proxy but am somehow unable to do so. I found a question which can potentially help to solve my problem (part of it at least) here: How to use HTTPBuilder behind a proxy with…
neneItaly
  • 263
  • 2
  • 9
2
votes
1 answer

java.lang.NoClassDefFoundError: groovyx.net.http.HTTPBuilder

When I run my grails application locally under Tomcat, I get no errors. When I deploy my WAR on my remote web server, I get this exception when I try to make an AJAX request that uses HTTPBuilder. How could this be happening?
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
2
votes
2 answers

What is the correct way of using ntlm authentication with RESTClient?

The follow code works fine but AuthPNames and AuthPolicy are marked as depreciated and I cannot find anything on what to replace it with. import groovyx.net.http.RESTClient def restClient = new…
Andrew Sumner
  • 793
  • 2
  • 12
  • 29
2
votes
1 answer

Groovy HTTPBuilder for api.github.com using OAuth

Good day! I generated a special Personal access tokens on github. I want to search some code into private repositories. When I use curl all works fine: curl -H 'Authorization: token ' -H 'Accept:…
V. Artyukhov
  • 644
  • 10
  • 18
2
votes
2 answers

How to construct an HTTP post with Groovy HTTPBuilder RESTClient

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' ], …
Jonathan Schneider
  • 26,852
  • 13
  • 75
  • 99
2
votes
2 answers

Unexpected Error 400:Bad Request HttpBuilder POST Request

I am using this code for POSTing JSON objeect to the URL groovy: def http = new HTTPBuilder( 'myURL' ) // perform a POST request, expecting JSON response data http.request( POST, JSON ) { uri.path = myPath uri.query = [ service_key:'1.0',…
monal86
  • 433
  • 2
  • 11
  • 26
2
votes
1 answer

Using HTTPBuilder and getting "java.net.SocketException: No buffer space available (maximum connections reached?): connect"

I'm using HTTPBuilder to build a client for the REST API of a NoSQL database. It works fine except when processing a large data set. After a large number of calls the client throws this exception: java.net.SocketException: No buffer space available…
2
votes
1 answer

Another issue when trying to POST JSON to REST URL via HttpBuilder

I read this and several other postings on SO and elsewhere about how to send a Post call via HttpBuilder with JSON as the data content. My problem is that NONE OF THOSE SOLUTIONS are working! My problem is only slightly different. I have existing…
JoeG
  • 7,191
  • 10
  • 60
  • 105
2
votes
2 answers

How to use HTTPBuilder behind a proxy with authentication

I tried 2 hours and could not make it work. This is what I did: grails add-proxy myproxy "--host=" "--port=" "--username=" "--password=" grails use-proxy myproxy I got connection refused error which mean the proxy is not…
user2644762
  • 21
  • 1
  • 2
2
votes
1 answer

How can I check for a key in json, which I am getting as an output from RESTful api

I have a confusion here with respect to RESTful api. Code: import groovyx.net.http.HTTPBuilder import static groovyx.net.http.Method.* import static groovyx.net.http.ContentType.JSON import org.codehaus.groovy.grails.web.json.JSONObject def…
Amy
  • 51
  • 1
  • 3
  • 6
2
votes
2 answers

Artifactory Search via REST API causes "Bad request" error

I’m trying to search artifacts using a groovy script and the REST API: def query = ‘artifactory/api/search/artifact?name=at.mic.all.feature&repos=features-qa-test-snapshot’ def server = new…
Frank Winkler
  • 409
  • 6
  • 16
2
votes
2 answers

Grails: Unable to resolve class groovyx.net.http.HTTPBuilder

I have developped some web services that I would like tu use in my grails application. These services can be called using Get or POST protocols. I have seen that I need to use the HTTP builder object to do that. This is my code: import…
Chewbye
  • 263
  • 1
  • 8
  • 20
2
votes
1 answer

how to assign reader of response to a variable from httpbuilder to controller

static def lemp(String aKey,String userName,String tType){ def temp try { def ret = null def http = new HTTPBuilder("http://192.168.1.10:8080/Pay-0.1/main/msgPicTemp") http.parser.'text/html' =…
Anantha
  • 109
  • 1
  • 1
  • 7
2
votes
1 answer

Where is groovy.json.JsonSlurper in groovy 1.7.8

I am running Grails 1.3.7; I have server A that needs to make a POST request on server B. I am using the http-builder library to make these requests. The request seems to be composed correctly RESTClient http = new RESTClient( searchServerUrl…
Gene Golovchinsky
  • 6,101
  • 7
  • 53
  • 81