REST Assured interview questions — Easy

159 easy-level REST Assured questions from our API Testing bank, each with the correct answer and an explanation of why it is correct.

What this covers

REST Assured appears throughout API Testing interviews. At easy level, interviewers are typically checking that you know the fundamentals and can describe them precisely — definitions, defaults, and the basic mechanics. Work through these, then explain your answer out loud; the second part is what interviews actually test.

20 example questions

  1. 1. In a test-strategy meeting, the question comes up: How do you assert data.id == 5 in a REST Assured body?

    • A. Body("data.id", equalTo(5)).correct
    • B. AssertEquals(5).
    • C. Expect(5).
    • D. Then().json(5).

    Why: REST Assured uses JsonPath with Hamcrest matchers.

  2. 2. Which of the following best describes then().statusCode(200) in REST Assured?

    • A. Reusable set of response expectations.
    • B. Sends the HTTP request to the endpoint.
    • C. Begins validation of the received response.correct
    • D. Sets or asserts the JSON content type.

    Why: then().statusCode(200): Begins validation of the received response.

  3. 3. In the context of REST Assured, then().statusCode(200) is best described as:

    • A. Starts request specification: params, headers, body, auth.
    • B. Sets or asserts the JSON content type.
    • C. Begins validation of the received response.correct
    • D. Disables SSL certificate validation for test environments.

    Why: then().statusCode(200): Begins validation of the received response.

  4. 4. In REST Assured, what does when().get("/users") do or refer to?

    • A. Adds a query string parameter to the request.
    • B. Disables SSL certificate validation for test environments.
    • C. Sends the HTTP request to the endpoint.correct
    • D. Starts request specification: params, headers, body, auth.

    Why: when().get("/users"): Sends the HTTP request to the endpoint.

  5. 5. Which of the following best describes ResponseSpecification in REST Assured?

    • A. Disables SSL certificate validation for test environments.
    • B. Sends the HTTP request to the endpoint.
    • C. Reusable set of response expectations.correct
    • D. Adds a query string parameter to the request.

    Why: ResponseSpecification: Reusable set of response expectations.

  6. 6. Which of the following best describes given() in REST Assured?

    • A. Disables SSL certificate validation for test environments.
    • B. Sets a named path parameter in the URL template.
    • C. Adds a query string parameter to the request.
    • D. Starts request specification: params, headers, body, auth.correct

    Why: given(): Starts request specification: params, headers, body, auth.

  7. 7. What is the purpose of contentType(ContentType.JSON) in REST Assured?

    • A. Sets a named path parameter in the URL template.
    • B. Adds a query string parameter to the request.
    • C. Sets or asserts the JSON content type.correct
    • D. Begins validation of the received response.

    Why: contentType(ContentType.JSON): Sets or asserts the JSON content type.

  8. 8. In a CI/CD pipeline review, consider this: extract().path("token") is used to:

    • A. Send a request.
    • B. Pull a value from the response for reuse.correct
    • C. Assert time.
    • D. Log headers.

    Why: extract() pulls values (JsonPath) to reuse, e.g. an auth token.

  9. 9. In REST Assured, what does contentType(ContentType.JSON) do or refer to?

    • A. Sets or asserts the JSON content type.correct
    • B. Starts request specification: params, headers, body, auth.
    • C. Sets a named path parameter in the URL template.
    • D. Sends the HTTP request to the endpoint.

    Why: contentType(ContentType.JSON): Sets or asserts the JSON content type.

  10. 10. What is the purpose of ResponseSpecification in REST Assured?

    • A. Begins validation of the received response.
    • B. Adds a query string parameter to the request.
    • C. Sends the HTTP request to the endpoint.
    • D. Reusable set of response expectations.correct

    Why: ResponseSpecification: Reusable set of response expectations.

  11. 11. In REST Assured, what does then().statusCode(200) do or refer to?

    • A. Adds a query string parameter to the request.
    • B. Sends the HTTP request to the endpoint.
    • C. Begins validation of the received response.correct
    • D. Sets or asserts the JSON content type.

    Why: then().statusCode(200): Begins validation of the received response.

  12. 12. Which of the following best describes contentType(ContentType.JSON) in REST Assured?

    • A. Sets or asserts the JSON content type.correct
    • B. Sends the HTTP request to the endpoint.
    • C. Starts request specification: params, headers, body, auth.
    • D. Reusable set of response expectations.

    Why: contentType(ContentType.JSON): Sets or asserts the JSON content type.

  13. 13. In REST Assured, what does relaxedHTTPSValidation() do or refer to?

    • A. Disables SSL certificate validation for test environments.correct
    • B. Reusable set of response expectations.
    • C. Sets a named path parameter in the URL template.
    • D. Sends the HTTP request to the endpoint.

    Why: relaxedHTTPSValidation(): Disables SSL certificate validation for test environments.

  14. 14. What is the purpose of then().statusCode(200) in REST Assured?

    • A. Starts request specification: params, headers, body, auth.
    • B. Sets a named path parameter in the URL template.
    • C. Reusable set of response expectations.
    • D. Begins validation of the received response.correct

    Why: then().statusCode(200): Begins validation of the received response.

  15. 15. Which of the following best describes when().get("/users") in REST Assured?

    • A. Disables SSL certificate validation for test environments.
    • B. Sets or asserts the JSON content type.
    • C. Sends the HTTP request to the endpoint.correct
    • D. Sets a named path parameter in the URL template.

    Why: when().get("/users"): Sends the HTTP request to the endpoint.

  16. 16. In REST Assured, what does ResponseSpecification do or refer to?

    • A. Begins validation of the received response.
    • B. Reusable set of response expectations.correct
    • C. Disables SSL certificate validation for test environments.
    • D. Adds a query string parameter to the request.

    Why: ResponseSpecification: Reusable set of response expectations.

  17. 17. Which of the following best describes relaxedHTTPSValidation() in REST Assured?

    • A. Disables SSL certificate validation for test environments.correct
    • B. Adds a query string parameter to the request.
    • C. Starts request specification: params, headers, body, auth.
    • D. Sets or asserts the JSON content type.

    Why: relaxedHTTPSValidation(): Disables SSL certificate validation for test environments.

  18. 18. What is the purpose of relaxedHTTPSValidation() in REST Assured?

    • A. Adds a query string parameter to the request.
    • B. Disables SSL certificate validation for test environments.correct
    • C. Sets a named path parameter in the URL template.
    • D. Reusable set of response expectations.

    Why: relaxedHTTPSValidation(): Disables SSL certificate validation for test environments.

  19. 19. Which of the following best describes pathParam in REST Assured?

    • A. Begins validation of the received response.
    • B. Sets a named path parameter in the URL template.correct
    • C. Adds a query string parameter to the request.
    • D. Sets or asserts the JSON content type.

    Why: pathParam: Sets a named path parameter in the URL template.

  20. 20. In REST Assured, what does given() do or refer to?

    • A. Adds a query string parameter to the request.
    • B. Begins validation of the received response.
    • C. Starts request specification: params, headers, body, auth.correct
    • D. Sends the HTTP request to the endpoint.

    Why: given(): Starts request specification: params, headers, body, auth.

Related API Testing topics