Broadleaf Microservices
  • v1.0.0-latest-prod

Customer Interactions

Table of Contents

Introduction

Customers are able to submit ratings and reviews for products and variants. They can also view, edit and delete their reviews.

List

Send a GET request to /customer/{customerId} to get a list of the customer’s RatingDetails.

Add

Send a POST request to /product/{productId} to post a new rating for a product. Send a POST request to /product/{productId}/variant/{variantId} to post a new rating for a variant.

The body of the request should be a RatingRequest. Not all fields are required.

Here is an example of a typical add request:

{
    "rating": 3,
    "customerId": "01FYM6EDTRC0270J2TRXHQ1EZX",
    "customerName": "Test Customer",
    "reviewTitle": "My review",
    "review": "3 stars"
}

Anonymous Ratings

This module supports ratings by anonymous customers, but that feature is disabled by default. To enable ratings by anonymous customers, set the property broadleaf.ratings.service.allow-anonymous-rating=true. Ratings by anonymous customers cannot be updated or deleted by the customer.

Update

Send a PUT or PATCH request to /customer/{customerId}/rating-detail/{detailId} to update an existing RatingDetail.

After an update, the status is changed back to PENDING if there is review or title text.

The request for an update is nearly the same as an add. Not all fields are required. However, the fields in the example below will be updated, so omitting a parameter or sending null would result in the RatingDetail field being updated to null.

{
    "rating": 5,
    "customerName": "Test Customer",
    "reviewTitle": "My review",
    "review": "My updated review"
}

Delete

Send a DELETE request to /customer/{customerId}/rating-detail/{detailId} to delete a RatingDetail.