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
0
votes
0 answers

Groovy API pagination

I'm trying to configure a groovy script on Jira to get data from another system through it's API. The script is working and I'm getting a payload back from the API call. But the problem is that the API on the other system is using pagination and I'm…
0
votes
1 answer

How to do a GET with multiple times the same parameters using httpbuilder and groovy?

I am using Groovy 1.8 and HttpBuilder 0.5.1 to talk to a REST webinterface. I have this working: def JSONArray tasks = httpBuilder.get( path: 'workspaces/'+LP_WORKSPACE_ID+'/tasks', query: [filter:'is_done is false'] ); def JSONArray tasks =…
Wim Deblauwe
  • 25,113
  • 20
  • 133
  • 211
0
votes
1 answer

Groovy Scraping Google Search Using HttpBuilder - Result doesn't seem to parse as html or xml

I am writing a simple Groovy script to request simple searches from Google Search and then parse the result set. I know that there is the Custom Search API - but that won't work for me, so please don't point me in that direction. I am using…
Tek Tengu
  • 141
  • 1
  • 1
  • 6
0
votes
0 answers

How to use SSL certificate in groovy script with http builder

How I can use SSL (CA) certificate (.pem file) in a Groovy script while using http-builder for making API calls. I am looking for something like the line below but sslContext is not available in http-builder:0.7.2 http.client.sslContext =…
0
votes
0 answers

Error sending XML request using Grails HTTPBuilder

I am trying to send a http POST using the following code :- def http = new HTTPBuilder("https://api.somewhere.com/prod/rest/send") http.request(Method.POST, ContentType.XML){ headers.'Authorization' = 'Basic VW52ZDYW06NGblahblahY3' …
Simon
  • 97
  • 3
  • 13
0
votes
0 answers

Download csv using groovy RESTClient

Have Groovy script class Using RestClient todownload the csv file, but on executing getting response as webpage. Please suggest on to download the csv from the link. Putting the link directly in browser downloads the csv file import…
Rajar R
  • 127
  • 1
  • 1
  • 10
0
votes
0 answers

HTTPBuilder Retry strategy

I have the following method in my Rest requests handler def get_Game(String gameId){ def gameInfo http.request(Method.GET, ContentType.XML){ uri.path = gamePath uri.query = [id : gameId] response.'200' = { resp,…
0
votes
1 answer

I get this error when working with jgritman / httpbuilder

I am new to Groovy and following a tutorial. Any help would be much appreciated. I also was unsuccessful in using @Grab. It is a Groovy project without Maven or Gradle. I have researched and couldn't find a solution, and the tutorial is not…
Mr. Disability
  • 799
  • 1
  • 10
  • 19
0
votes
1 answer

How to write Unit Test for HTTPBuilder using SPOCK framework?

I want the Unit Test to go through both, Success and Failure execution paths. How to make the test case to go to Success or Failure path? void addRespondents() { http.request(POST, TEXT) { uri.path = PATH …
Surferzzz
  • 3
  • 3
0
votes
1 answer

Groovy error in getting response: groovyx.net.http.HTTPBuilder handleResponse WARNING: Error parsing 'text/html' response groovy.json.JsonException

The current character read is '<' with an int value of 60 Unable to determine the current character, it is not a string, number, array, or object line number 1 index number 0 *body for the POST method* ``` def jsonBody = [ "grant_type":…
0
votes
0 answers

Send raw body data with HTTPBuilder

I need to make POST request with raw body data. How can I do it with HTTPBuilder? In postman it works fine when I choose body type raw and Postman Collections looks like this: { "info": { "_postman_id": "id", "name": "Requests", …
Duxa
  • 55
  • 1
  • 7
0
votes
1 answer

Missing classes of HttpBuilder in Groovy

Here is simple request I try to do and watch response def httpReq = new HTTPBuilder("http://${url}") httpReq.request(Method.GET, ContentType.JSON) { response.success = { resp -> println("Ok " +…
Duxa
  • 55
  • 1
  • 7
0
votes
1 answer

How add dependencies into groovy script?

I try to add HttpBuilder into groovy script, but can do it only manually (Alt+Ctrl+Shift+S add dependencie). But when I start script I have error in line of creating new httpbuilder instance java.lang.ClassNotFoundException:…
Duxa
  • 55
  • 1
  • 7
0
votes
1 answer

Can HTTPBuilder parse a response with a different content-type to the request?

We're trying to use Groovy's HTTPBuilder's request method to send a POST request with a content type of application/x-www-form-urlencoded, and parse the response from the server, which has a content type of application/json. The library ignores the…
AML
  • 312
  • 3
  • 10
0
votes
0 answers

Facing issue while adding attachment through Groovy code

I am using ZAPI (Zephyr API) to make get,post and put requests through groovy code and read data/update JIRA. While get and put requests are working fine via groovy code, i am facing issue in adding an attachment (Text File). Below is the code…