ROOM & PROPERTY API

Return Property Reviews API

Technical documentation for the method that retrieves guest reviews for a specific property.

Summary

Purpose Retrieve guest reviews from the database for a specific property and return them as a GuestReviews object.
Entry Method POST /returnPropertyReviews
Input PropertyJson object containing the property ID.
Output GuestReviews object containing a list of guest reviews.

Description

This endpoint is used to retrieve all guest reviews related to a property, map them into GuestReview objects, and return them wrapped inside a GuestReviews response object.

Endpoint

POST /returnPropertyReviews

Request

Content-Type: application/json

Authorization: Bearer <token>

Field Type Description
Id Long Property identifier
Request Body Example
{
  "id": 15
}

Process

  • The Property is retrieved from the database using propertyJson.getId().
  • All ReviewsTab entries related to the property are retrieved.
  • An empty list of GuestReview objects is created.
  • Each ReviewsTab is iterated.
  • For each review, the guest full name is built from first_name and last_name.
  • Review ratings are extracted from the review entry.
  • Positive and negative comments are extracted.
  • The review date is retrieved.
  • A GuestReview object is created and added to the list.
  • All guest reviews are wrapped into a GuestReviews object.
  • The GuestReviews object is returned as the response.

JSON Structure Returned

The final object returned contains a list of guest reviews. Each review includes the guest name, ratings, comments, and review date.

Field Type Description
guestReviews Array Main list of guest reviews.
guestName String Full name of the guest.
staffReview Number Staff rating.
facilitiesReview Number Facilities rating.
cleanlessReview Number Cleanliness rating.
comfortReview Number Comfort rating.
valueOfMoneyReview Number Value for money rating.
locationReview Number Location rating.
goodReview String Positive feedback.
badReview String Negative feedback.
date Date Review date.

Example JSON Returned

{
  "guestReviews": [
    {
      "guestName": "John Doe",
      "staffReview": 9,
      "facilitiesReview": 8,
      "cleanlessReview": 10,
      "comfortReview": 9,
      "valueOfMoneyReview": 8,
      "locationReview": 9,
      "goodReview": "Very clean room and friendly staff.",
      "badReview": "Wi-Fi could be better.",
      "date": "2026-03-10"
    },
    {
      "guestName": "Anna Smith",
      "staffReview": 10,
      "facilitiesReview": 9,
      "cleanlessReview": 9,
      "comfortReview": 10,
      "valueOfMoneyReview": 9,
      "locationReview": 10,
      "goodReview": "Excellent location and very comfortable stay.",
      "badReview": "Breakfast options were limited.",
      "date": "2026-03-09"
    }
  ]
}

Notes

  • If the specified property does not exist, the operation may result in an exception due to the way the data is retrieved.
  • The current implementation assumes that all related data and review details are always present, which may not be the case in all scenarios.
  • There is also an unnecessary internal variable that is defined but not used, and it can be safely removed to improve code clarity.
  • Additionally, the endpoint configuration should follow the correct mapping approach to ensure it is properly exposed and accessible.