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
1
vote
2 answers

How does one save cookies in HTTP Builder 0.5.0/HTTPClient

I am trying per instructions here: http://www.innovation.ch/java/HTTPClient/advanced_info.html However, if I am using HTTP Builder, the following…
Миша Кошелев
  • 1,483
  • 1
  • 24
  • 41
1
vote
1 answer

Vertical response api in grails

I'm trying to use Vertical response api in my grails project. But it giving following error CODE: def http = new HTTPBuilder() http.request('https://vrapi.verticalresponse.com/',GET, TEXT) { req -> uri.path = 'api/v1/contacts?type=basic' …
Pranav C Balan
  • 113,687
  • 23
  • 165
  • 188
1
vote
2 answers

Groovy httpBuilder POST XML with Basic Authentication

I am trying to send a POST request to a Restful WS with the request originally being xml and so is the response. I need to have basic authentication sent as well. At first I was having issues with Classes not being defined and thankfully it took …
sam3r_11
  • 21
  • 1
  • 4
1
vote
1 answer

ignoring cookies in Groovy HTTPBuilder

I'm getting a lot of these warning messages on a REST client call that doesn't require cookies: [http-bio-8080-exec-10] WARN protocol.ResponseProcessCookies - Cookie rejected: "[version: 1][name: mzf_in][value: 990108][domain: .xxxx.com][path:…
AlejandroVD
  • 1,576
  • 19
  • 22
1
vote
1 answer

Groovy HttpBuilder issues with cookies

I need to write a web client that hits a legacy web app, logs in to it, pulls down some information from a /widget page, and does some work based off of this page's HTML. I'm choosing to go with a Groovy/HttpBuilder solution, for reasons outside the…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
1
vote
2 answers

Access to JSON element in groovy map

I'm trying to access an element of some json returned into a map from an api call so I can pass it to another api call. I can't seem to properly create a varible and give it the value I need. Here's the returned json, I need to access the Id…
Baci
  • 185
  • 2
  • 9
1
vote
1 answer

groovy: how to catch exceptions on AsyncHttpBuilder

i'm trying to make an async call to a domain. The following code works well if i specify a valid address with json response, but when the address is not valid, i want to be able to catch any possible exceptions. How can i catch the returned…
Giorgio Andretti
  • 198
  • 1
  • 15
1
vote
2 answers

Sendgrid adding email to list, getting bad request in grails

I am trying to use following code to send request to sendgrid for adding emails to list, but i always keep getting 404 : Bad request. def chttps = new…
1
vote
0 answers

Unexpected error: 403 : Forbidden:Bad Request HttpBuilder Get Request

I am using this code for GETting JSON objeect from the URL groovy: when i try it in browser it work very well but whent i try it in my program with httpbuider i have Unexpected error: 403 : Forbidden(meaning that it doesn't a key api but i put it…
user2936743
  • 61
  • 5
  • 13
1
vote
1 answer

Uploading File Using HttpBuilder over SSL

I am attempting to upload a file to web service that is running over SSL using HttpBuilder. I'm doing this from a Gradle build file but I don't believe it really matters. The web service is part of a Grails app, but again, don't think that…
Gregg
  • 34,973
  • 19
  • 109
  • 214
1
vote
1 answer

Multi requests to Youtube API V2 using Groovy

I have a list of youtube videos from different playlists and I need to check if these videos are still valid (they are around 1000). What I am doing at the moment it is hitting Youtube using its API v2 and Groovy with this simple script: import…
Randomize
  • 8,651
  • 18
  • 78
  • 133
1
vote
2 answers

Groovy HTTP Builder: Empty POST response causes SAXParseException

I am implementing REST client for YouTrack API. I am getting an exception whenever my POST requests return empty response (there's just a valid header). The HTTP status code is 200. That's the stacktrace: [Fatal Error] :-1:-1: Premature end of…
botchniaque
  • 4,698
  • 3
  • 35
  • 63
1
vote
1 answer

Groovy RESTClient returns inconsistent type on response handler

I am attempting to write my own response handlers for Groovy's RESTClient (which wraps around HttpBuilder). I want to always print the response body if one is returned. However, I cannot find a consistent way to do it. Typically a custom response…
smcg
  • 3,195
  • 2
  • 30
  • 40
1
vote
1 answer

JSON format results from HTTPBuilder GET changed between 0.5.2 and 0.6

We recently updated dependencies of a REST integration test which uses Groovy, HTTPBuilder, JSONAssert and Junit. When we went from HTTPBuilder 0.5.2 to 0.6 many of our tests failed. We found that the format of the response changed due to a new…
Robert
  • 675
  • 8
  • 16
1
vote
2 answers

HTTPBuilder gets 403 while cURL works fine (GitHub API)

A GET request sent to https://api.github.com/users/username works from the command line and via URL#text, but fails using HTTPBuilder. The code: new HTTPBuilder('https://api.github.com').get(path: '/users/xan', contentType: JSON) //…
acorello
  • 4,473
  • 4
  • 31
  • 46