AIRBNB
FRONTEND GUIDE FOR AI CODING AGENTS - PART 11 - ReviewSystem Service
This document is a part of a REST API guide for the airbnb project. It is designed for AI agents that will generate frontend code to consume the project’s backend.
This document provides extensive instruction for the usage of reviewSystem
Service Access
ReviewSystem service management is handled through service specific base urls.
ReviewSystem service may be deployed to the preview server, staging server, or production server. Therefore,it has 3 access URLs. The frontend application must support all deployment environments during development, and the user should be able to select the target API server on the login page (already handled in first part.).
For the reviewSystem service, the base URLs are:
- Preview:
https://airbnb3.prw.mindbricks.com/reviewsystem-api - Staging:
https://airbnb3-stage.mindbricks.co/reviewsystem-api - Production:
https://airbnb3.mindbricks.co/reviewsystem-api
Scope
ReviewSystem Service Description
Handles double-blind, moderated reviews and rating aggregation for stays. Allows guests/hosts to review each other and listings, supports moderation, and exposes aggregate stats for listings/profiles…
ReviewSystem service provides apis and business logic for following data objects in airbnb application. Each data object may be either a central domain of the application data structure or a related helper data object for a central concept. Note that data object concept is equal to table concept in the database, in the service database each data object is represented as a db table scheme and the object instances as table rows.
reviewAggregate Data Object: Cached aggregate rating stats for a listing, host, or guest. Used for fast lookup and display of averages, counts, etc.
review Data Object: Review submitted by a guest or host after a completed stay. Enables double-blind, supports moderation, and links to reservation/listing and users.
API Structure
Object Structure of a Successful Response
When the service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope includes the data and essential metadata such as configuration details and pagination information, providing context to the client.
HTTP Status Codes:
- 200 OK: Returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request was processed successfully.
- 201 Created: Returned for CREATE operations, indicating that the resource was created successfully.
Success Response Format:
For successful operations, the response includes a "status": "OK" property, signaling that the request executed successfully. The structure of a successful response is outlined below:
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3,
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
products: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation.
Additional Data
Each API may include additional data besides the main data object, depending on the business logic of the API. These will be provided in each API’s response signature.
Error Response
If a request encounters an issue—whether due to a logical fault or a technical problem—the service responds with a standardized JSON error structure. The HTTP status code indicates the nature of the error, using commonly recognized codes for clarity:
- 400 Bad Request: The request was improperly formatted or contained invalid parameters.
- 401 Unauthorized: The request lacked a valid authentication token; login is required.
- 403 Forbidden: The current token does not grant access to the requested resource.
- 404 Not Found: The requested resource was not found on the server.
- 500 Internal Server Error: The server encountered an unexpected condition.
Each error response is structured to provide meaningful insight into the problem, assisting in efficient diagnosis and resolution.
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
ReviewAggregate Data Object
Cached aggregate rating stats for a listing, host, or guest. Used for fast lookup and display of averages, counts, etc.
ReviewAggregate Data Object Properties
ReviewAggregate data object has got following properties that are represented as table fields in the database scheme. These properties don’t stand just for data storage, but each may have different settings to manage the business logic.
| Property | Type | IsArray | Required | Secret | Description |
|---|---|---|---|---|---|
revieweeId |
ID | false | Yes | No | - |
revieweeType |
Enum | false | Yes | No | - |
averageRating |
Double | false | Yes | No | - |
reviewCount |
Integer | false | Yes | No | - |
visibilityStatus |
Enum | false | Yes | No | - |
- Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.
Enum Properties
Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. The enum options value will be stored as strings in the database, but when a data object is created an additional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option. You can use the {fieldName_idx} property to sort by the enum value or when your enum options represent a hiyerarchy of values. In the frontend input components, enum type properties should only accept values from an option component that lists the enum options.
-
revieweeType: [host, guest, listing]
-
visibilityStatus: [public, hidden]
Relation Properties
revieweeId
Mindbricks supports relations between data objects, allowing you to define how objects are linked together. The relations may reference to a data object either in this service or in another service. Id the reference is remote, backend handles the relations through service communication or elastic search. These relations should be respected in the frontend so that instaead of showing the related objects id, the frontend should list human readable values from other data objects. If the relation points to another service, frontend should use the referenced service api in case it needs related data. The relation logic is montly handled in backend so the api responses feeds the frontend about the relational data. In mmost cases the api response will provide the relational data as well as the main one.
In frontend, please ensure that,
1- instaead of these relational ids you show the main human readable field of the related target data (like name), 2- if this data object needs a user input of these relational ids, you should provide a combobox with the list of possible records or (a searchbox) to select with the realted target data object main human readable field.
- revieweeId: ID
Relation to
user.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: No
Filter Properties
revieweeId revieweeType
Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria. These properties are automatically mapped as API parameters in the listing API’s.
-
revieweeId: ID has a filter named
revieweeId -
revieweeType: Enum has a filter named
revieweeType
Review Data Object
Review submitted by a guest or host after a completed stay. Enables double-blind, supports moderation, and links to reservation/listing and users.
Review Data Object Properties
Review data object has got following properties that are represented as table fields in the database scheme. These properties don’t stand just for data storage, but each may have different settings to manage the business logic.
| Property | Type | IsArray | Required | Secret | Description |
|---|---|---|---|---|---|
moderationStatus |
Enum | false | Yes | No | - |
isPublished |
Boolean | false | Yes | No | - |
reviewText |
Text | false | Yes | No | - |
rating |
Integer | false | Yes | No | - |
blindSubmissionCode |
String | false | Yes | No | - |
revieweeId |
ID | false | Yes | No | - |
reservationId |
ID | false | Yes | No | - |
reviewerId |
ID | false | Yes | No | - |
revieweeType |
Enum | false | Yes | No | - |
submittedAt |
Date | false | Yes | No | - |
- Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.
Enum Properties
Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. The enum options value will be stored as strings in the database, but when a data object is created an additional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option. You can use the {fieldName_idx} property to sort by the enum value or when your enum options represent a hiyerarchy of values. In the frontend input components, enum type properties should only accept values from an option component that lists the enum options.
-
moderationStatus: [pending, approved, rejected]
-
revieweeType: [host, guest, listing]
Relation Properties
revieweeId reservationId reviewerId
Mindbricks supports relations between data objects, allowing you to define how objects are linked together. The relations may reference to a data object either in this service or in another service. Id the reference is remote, backend handles the relations through service communication or elastic search. These relations should be respected in the frontend so that instaead of showing the related objects id, the frontend should list human readable values from other data objects. If the relation points to another service, frontend should use the referenced service api in case it needs related data. The relation logic is montly handled in backend so the api responses feeds the frontend about the relational data. In mmost cases the api response will provide the relational data as well as the main one.
In frontend, please ensure that,
1- instaead of these relational ids you show the main human readable field of the related target data (like name), 2- if this data object needs a user input of these relational ids, you should provide a combobox with the list of possible records or (a searchbox) to select with the realted target data object main human readable field.
- revieweeId: ID
Relation to
user.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: No
- reservationId: ID
Relation to
reservation.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: Yes
- reviewerId: ID
Relation to
user.id
The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.
Required: Yes
Filter Properties
revieweeId reservationId reviewerId revieweeType
Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria. These properties are automatically mapped as API parameters in the listing API’s.
-
revieweeId: ID has a filter named
revieweeId -
reservationId: ID has a filter named
reservationId -
reviewerId: ID has a filter named
reviewerId -
revieweeType: Enum has a filter named
revieweeType
Default CRUD APIs
For each data object, the backend architect may designate default APIs for standard operations (create, update, delete, get, list). These are the APIs that frontend CRUD forms and AI agents should use for basic record management. If no default is explicitly set (isDefaultApi), the frontend generator auto-discovers the most general API for each operation.
ReviewAggregate Default APIs
| Operation | API Name | Route | Explicitly Set |
|---|---|---|---|
| Create | none | - | Auto |
| Update | none | - | Auto |
| Delete | none | - | Auto |
| Get | getReviewAggregate |
/v1/reviewaggregates/:reviewAggregateId |
Auto |
| List | listReviewAggregates |
/v1/reviewaggregates |
Auto |
Review Default APIs
| Operation | API Name | Route | Explicitly Set |
|---|---|---|---|
| Create | createReview |
/v1/reviews |
Auto |
| Update | updateReview |
/v1/reviews/:reviewId |
Auto |
| Delete | deleteReview |
/v1/reviews/:reviewId |
Auto |
| Get | getReview |
/v1/reviews/:reviewId |
Auto |
| List | listReviews |
/v1/reviews |
Auto |
When building CRUD forms for a data object, use the default create/update APIs listed above. The form fields should correspond to the API’s body parameters. For relation fields, render a dropdown loaded from the related object’s list API using the display label property.
API Reference
Get Review API
Retrieve a review and, if double-blind complete, return full info. Enrich with reviewer/reviewee & reservation if allowed by publish and moderation/business rules.
Rest Route
The getReview API REST controller can be triggered via the following route:
/v1/reviews/:reviewId
Rest Request Parameters
The getReview api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| reviewId | ID | true | request.params?.[“reviewId”] |
| reviewId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/reviews/:reviewId
axios({
method: 'GET',
url: `/v1/reviews/${reviewId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "review",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"review": {
"id": "ID",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"isPublished": "Boolean",
"reviewText": "Text",
"rating": "Integer",
"blindSubmissionCode": "String",
"revieweeId": "ID",
"reservationId": "ID",
"reviewerId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"submittedAt": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
List Reviewaggregates API
List aggregate rating stats for listings or user profiles (cache-friendly, e.g., for search results or admin export).
Rest Route
The listReviewAggregates API REST controller can be triggered via the following route:
/v1/reviewaggregates
Rest Request Parameters
Filter Parameters
The listReviewAggregates api supports 2 optional filter parameters for filtering list results:
revieweeId (ID): Filter by revieweeId
- Single:
?revieweeId=<value> - Multiple:
?revieweeId=<value1>&revieweeId=<value2> - Null:
?revieweeId=null
revieweeType (Enum): Filter by revieweeType
- Single:
?revieweeType=<value>(case-insensitive) - Multiple:
?revieweeType=<value1>&revieweeType=<value2> - Null:
?revieweeType=null
REST Request To access the api you can use the REST controller with the path GET /v1/reviewaggregates
axios({
method: 'GET',
url: '/v1/reviewaggregates',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// revieweeId: '<value>' // Filter by revieweeId
// revieweeType: '<value>' // Filter by revieweeType
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reviewAggregates",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"reviewAggregates": [
{
"id": "ID",
"revieweeId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"averageRating": "Double",
"reviewCount": "Integer",
"visibilityStatus": "Enum",
"visibilityStatus_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Create Review API
Guest or host submits review for completed reservation. Double-blind: published after both reviews or expiry. Moderation applies. Only allowed if session.user is guest/host of reservation and not already reviewed.
Rest Route
The createReview API REST controller can be triggered via the following route:
/v1/reviews
Rest Request Parameters
The createReview api has got 7 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| moderationStatus | Enum | true | request.body?.[“moderationStatus”] |
| isPublished | Boolean | true | request.body?.[“isPublished”] |
| reviewText | Text | true | request.body?.[“reviewText”] |
| rating | Integer | true | request.body?.[“rating”] |
| revieweeId | ID | true | request.body?.[“revieweeId”] |
| reservationId | ID | true | request.body?.[“reservationId”] |
| revieweeType | Enum | true | request.body?.[“revieweeType”] |
| moderationStatus : | |||
| isPublished : | |||
| reviewText : | |||
| rating : | |||
| revieweeId : | |||
| reservationId : | |||
| revieweeType : |
REST Request To access the api you can use the REST controller with the path POST /v1/reviews
axios({
method: 'POST',
url: '/v1/reviews',
data: {
moderationStatus:"Enum",
isPublished:"Boolean",
reviewText:"Text",
rating:"Integer",
revieweeId:"ID",
reservationId:"ID",
revieweeType:"Enum",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "review",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"review": {
"id": "ID",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"isPublished": "Boolean",
"reviewText": "Text",
"rating": "Integer",
"blindSubmissionCode": "String",
"revieweeId": "ID",
"reservationId": "ID",
"reviewerId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"submittedAt": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Delete Review API
Allows hard or soft-delete of review pre-publish (reviewer) or at any time (admin/moderator). Deletion triggers aggregate recalc.
Rest Route
The deleteReview API REST controller can be triggered via the following route:
/v1/reviews/:reviewId
Rest Request Parameters
The deleteReview api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| reviewId | ID | true | request.params?.[“reviewId”] |
| reviewId : This id paremeter is used to select the required data object that will be deleted |
REST Request To access the api you can use the REST controller with the path DELETE /v1/reviews/:reviewId
axios({
method: 'DELETE',
url: `/v1/reviews/${reviewId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "review",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"review": {
"id": "ID",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"isPublished": "Boolean",
"reviewText": "Text",
"rating": "Integer",
"blindSubmissionCode": "String",
"revieweeId": "ID",
"reservationId": "ID",
"reviewerId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"submittedAt": "Date",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Get Reviewaggregate API
Get aggregate rating stats for listing or user profile (fast lookup cache for UI display).
Rest Route
The getReviewAggregate API REST controller can be triggered via the following route:
/v1/reviewaggregates/:reviewAggregateId
Rest Request Parameters
The getReviewAggregate api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| reviewAggregateId | ID | true | request.params?.[“reviewAggregateId”] |
| reviewAggregateId : This id paremeter is used to query the required data object. |
REST Request To access the api you can use the REST controller with the path GET /v1/reviewaggregates/:reviewAggregateId
axios({
method: 'GET',
url: `/v1/reviewaggregates/${reviewAggregateId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reviewAggregate",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"reviewAggregate": {
"id": "ID",
"revieweeId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"averageRating": "Double",
"reviewCount": "Integer",
"visibilityStatus": "Enum",
"visibilityStatus_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
List Reviews API
List published/approved reviews for listing, host, or guest profile. Double-blind: only list reviews when available (both submitted or timer expired & published). Optional filters: revieweeId, revieweeType, reservationId.
Rest Route
The listReviews API REST controller can be triggered via the following route:
/v1/reviews
Rest Request Parameters
Filter Parameters
The listReviews api supports 4 optional filter parameters for filtering list results:
revieweeId (ID): Filter by revieweeId
- Single:
?revieweeId=<value> - Multiple:
?revieweeId=<value1>&revieweeId=<value2> - Null:
?revieweeId=null
reservationId (ID): Filter by reservationId
- Single:
?reservationId=<value> - Multiple:
?reservationId=<value1>&reservationId=<value2> - Null:
?reservationId=null
reviewerId (ID): Filter by reviewerId
- Single:
?reviewerId=<value> - Multiple:
?reviewerId=<value1>&reviewerId=<value2> - Null:
?reviewerId=null
revieweeType (Enum): Filter by revieweeType
- Single:
?revieweeType=<value>(case-insensitive) - Multiple:
?revieweeType=<value1>&revieweeType=<value2> - Null:
?revieweeType=null
REST Request To access the api you can use the REST controller with the path GET /v1/reviews
axios({
method: 'GET',
url: '/v1/reviews',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// revieweeId: '<value>' // Filter by revieweeId
// reservationId: '<value>' // Filter by reservationId
// reviewerId: '<value>' // Filter by reviewerId
// revieweeType: '<value>' // Filter by revieweeType
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reviews",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"reviews": [
{
"id": "ID",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"isPublished": "Boolean",
"reviewText": "Text",
"rating": "Integer",
"blindSubmissionCode": "String",
"revieweeId": "ID",
"reservationId": "ID",
"reviewerId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"submittedAt": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Update Review API
Allows reviewer to edit own review before publish OR admin/mod to update moderation fields. Enforces state business rules.
Rest Route
The updateReview API REST controller can be triggered via the following route:
/v1/reviews/:reviewId
Rest Request Parameters
The updateReview api has got 4 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| reviewId | ID | true | request.params?.[“reviewId”] |
| moderationStatus | Enum | false | request.body?.[“moderationStatus”] |
| isPublished | Boolean | false | request.body?.[“isPublished”] |
| reviewText | Text | false | request.body?.[“reviewText”] |
| reviewId : This id paremeter is used to select the required data object that will be updated | |||
| moderationStatus : | |||
| isPublished : | |||
| reviewText : |
REST Request To access the api you can use the REST controller with the path PATCH /v1/reviews/:reviewId
axios({
method: 'PATCH',
url: `/v1/reviews/${reviewId}`,
data: {
moderationStatus:"Enum",
isPublished:"Boolean",
reviewText:"Text",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "review",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"review": {
"id": "ID",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"isPublished": "Boolean",
"reviewText": "Text",
"rating": "Integer",
"blindSubmissionCode": "String",
"revieweeId": "ID",
"reservationId": "ID",
"reviewerId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"submittedAt": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
After this prompt, the user may give you new instructions to update the output of this prompt or provide subsequent prompts about the project.