Questions tagged [rest-assured]

REST Assured is a Java library that provides a domain-specific language (DSL) for writing powerful, maintainable tests for RESTful APIs.

REST Assured enables testing of REST services in Java.

It uses a fluid syntax inspired by similar libraries for and .

2207 questions
13
votes
1 answer

Get the url of a redirect with Rest Assured?

I am making a GET request which then makes a 307 redirect to another URL and from there it makes another 302 redirect and so on till it gets to the requested page. I am having problems extracting the URL from the first redirect, the 307, I want to…
Gudzo
  • 639
  • 2
  • 8
  • 21
13
votes
5 answers

How to pass Query String Parameters in GET url using Rest Assured?

How to pass Query String Parameters in GET url using Rest Assured? URL is: http://example.com/building My Query Strings are…
13
votes
2 answers

org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected

I am trying out RestAssured & wrote the following statements - String URL = "http://XXXXXXXX"; Response result = given(). header("Authorization","Basic xxxx"). contentType("application/json"). when(). …
13
votes
1 answer

Use rest-assured as a general purpose http client

Is there any reason to avoid using rest-assured in a non-testing-environment? The syntax the library offers for creating and parsing requests is so compact it seems a waste to only use it in testing. Which kind of begs the question, why is it…
eladidan
  • 2,634
  • 2
  • 26
  • 39
12
votes
4 answers

How to send form-data in api using Rest-assured

I want to send below as a form-data in API Body for a PUT request: Upload a file(KEY) with "Error.png"(VALUE) Send text, "MyName"(KEY) with false(VALUE) How to do this using REST-Assured Attached is the screenshot
D Bhatnagar
  • 133
  • 1
  • 1
  • 9
12
votes
2 answers

What is the difference between io.rest-assured vs jayway rest-assured?

What is the difference between io.rest-assured vs jayway rest-assured? Which framework should i use for restfull webservice testing?
user1459497
  • 659
  • 2
  • 9
  • 18
12
votes
3 answers

Automate Rest API test and integrate this with Continuous Integration(CI-Jenkins)

I found many similar questions related to this, but not the particular answer I am looking for. Actually my requirement is little different, so I end up posting the following issue. I want to automate Rest APIs, and I got two options for the same…
undefined
  • 3,464
  • 11
  • 48
  • 90
11
votes
3 answers

The import io.restassured.RestAssured cannot be resolved

Hi I am not able to resolve the error while using rest assured 4.1.1. library in my Eclipse IDE. I have added the rest assured library in my pom.xml file still the error is not resolved. I tried re-importing the rest assured library from…
11
votes
3 answers

Configure RestAssured to use GSON over Jackson?

I have both GSON and Jackson in a project using RestAssured and I want to use GSON. The official documentation does not provide a clear example. I tried several configs, but it does not seem to work. Here's my config, am I missing…
vicusbass
  • 1,714
  • 2
  • 19
  • 33
11
votes
1 answer

How to implement a re-try logic in RestAssured for a failed REST call

I am using RestAssured for firing API calls and wanted to implement a retry logic if the REST calls fails. The requirement is because we are getting intermittent 500 response codes for certain APIs which usually work upon a re-try. I have…
palkarrohan
  • 459
  • 1
  • 4
  • 16
11
votes
3 answers

How to set cookie with the request using rest assured?

I need to automate the rest API. The API is secured with Spring security. Below is the code to authenticate : Response response = given().auth() .form(userName, password, FormAuthConfig.springSecurity().withLoggingEnabled(new…
kartoos
  • 127
  • 1
  • 1
  • 5
11
votes
2 answers

How to test REST endpoint when using callbacks using JAVA?

I want to write some test against an REST endpoint which is using a callback parameter. Might sound confusing so here's an explanation: first call is a POST to /publish with the payload: {"callbackURL":"http://localhost:609/test"} server replies…
vicusbass
  • 1,714
  • 2
  • 19
  • 33
11
votes
3 answers

RESTAssured recieve one of two possible status codes

I have test(!) code of RESTAssured, that checks that REST endpoint returns me 0 as status code; given() .contentType(CONTENT_TYPE_APPLICATION_JSON) .when() .get(getRestOperationPath()) .then() …
Andrii Plotnikov
  • 3,022
  • 4
  • 17
  • 37
11
votes
2 answers

Jersey returns 404 with any error status code?

I have this useless endpoint in path "/test": @PUT public Response doSomething() { return Response.status(409).build(); } and I test it this way: @Test public void uselessTest() { put("/test").then().assertThat().statusCode(409); } But I get…
Héctor
  • 24,444
  • 35
  • 132
  • 243
11
votes
3 answers

Checking HTML document with REST Assured

I'm trying to use REST Assured to check some properties on an HTML document returned by my server. An SSCCE demonstrating the problem would be as follows: import static com.jayway.restassured.path.xml.config.XmlPathConfig.xmlPathConfig; import…
ZeroOne
  • 3,041
  • 3
  • 31
  • 52