REST Assured is a Java library for automating acceptance tests against REST APIs. It sends programmatic HTTP requests, extracts response data, and supports readable assertions without browser overhead. section 13.0 section 13.7
Use REST Assured to:
- Submit JSON POST and GET requests to application endpoints. section 13.4.2 section 13.4.5
- Extract individual values with JSONPath, such as a generated frequent flyer number. section 13.4.2 section 13.7
- Map selected JSON fields into Java records while ignoring unrelated response properties. section 13.4.5
- Centralize the base URI and obtain it from environment configuration when tests target different environments. section 13.4.2 section 13.7
Registering and checking an account
A MembershipAPI client can submit a JSON registration, extract frequentFlyerNumber, then request the account status and assert its tier, activation state, and points. A focused response model avoids coupling the test to unrelated JSON fields. section 13.4.2 section 13.4.5
Response response = RestAssured.given() #1
.contentType(ContentType.JSON) #2
.body(newMember) #3
.post("http://localhost:3000/api/frequent-flyer"); #4
Shows the fluent request construction for a JSON POST: set content type, provide the member body, and call the endpoint. section 13.4.2
public AccountStatus getMemberStatus(String frequentFlyerNumber) {
return RestAssured.given()
.get("/frequent-flyer/{number}", frequentFlyerNumber) #1
.jsonPath()
.getObject(".", AccountStatus.class); #2
}
Shows a GET request using a path parameter and conversion of the JSON response into a focused AccountStatus record. section 13.4.5

