Skip to content

list-product-reviews

Method: GET
Path: /catalog/products/{product_id}/reviews

Tags: Catalog

Summary

List all product reviews

Description

List of reviews for a specified product. The reviews are returned sorted by submission date, with the most recent reviews appearing first. You can filter the reviews by rating, reviewer, or date for more detailed analysis.

Storefront SDK Usage

SDK Method: sdk.catalog.listProductReviews()

Example:

typescript
const { data, error } = await sdk.catalog.listProductReviews(
  { product_id: "prod_123" }
);

if (error) {
  console.error("Failed to list product reviews:", error);
  return;
}

console.log("Reviews found:", data.reviews?.length || 0);

data.reviews?.forEach(review => {
  console.log(`Review by ${review.customer_name}: ${review.rating}/5`);
  console.log("Comment:", review.comment);
});

// With pagination
const { data: reviewData, error: reviewError } = await sdk.catalog.listProductReviews(
  { product_id: "prod_123" },
  {
    page: 1,
    limit: 5
  }
);

TypeScript Definition

typescript
"list-product-reviews": {
        parameters: {
            query?: {
                /** @description page number of pagination list */
                page?: components["parameters"]["pageParam"];
                /** @description no of rows per page */
                limit?: components["parameters"]["pageLimitParam"];
                /** @description JSON string format: {"field1":"asc", "field2":"desc"} */
                sort_by?: components["parameters"]["sortingParam"];
                /** @description search keyword */
                search?: components["parameters"]["searchKeyword"];
                /** @description filter review with review tag */
                review_tag?: string;
            };
            header?: never;
            path: {
                /** @description id of a particular product */
                product_id: string;
            };
            cookie?: never;
        };
        requestBody?: never;
        responses: {
            /** @description Success response */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        message: string;
                        success: boolean;
                        content: {
                            reviews: components["schemas"]["ProductReview"][];
                            review_tags?: string[] | null;
                            pagination?: components["schemas"]["Pagination"];
                        };
                    };
                };
            };
            401: components["responses"]["Unauthorized"];
            404: components["responses"]["NotFound"];
        };
    };

Component References

ReferenceResolves To
components["parameters"]["pageParam"]pageParam
components["parameters"]["pageLimitParam"]pageLimitParam
components["parameters"]["sortingParam"]sortingParam
components["parameters"]["searchKeyword"]searchKeyword
components["schemas"]["ProductReview"]ProductReview
components["schemas"]["Pagination"]Pagination
components["responses"]["Unauthorized"]Unauthorized
components["responses"]["NotFound"]NotFound

Parameters

  • page (query): page number of pagination list
  • limit (query): no of rows per page
  • sort_by (query): JSON string format: {"field1":"asc", "field2":"desc"}
  • search (query): search keyword
  • product_id (path): id of a particular product
  • review_tag (query): filter review with review tag

Responses

200

Success response

401

Not authorized for given operation on the Resource

404

Requested resource not found

OpenAPI Definition

json
{
  "tags": [
    "Catalog"
  ],
  "operationId": "list-product-reviews",
  "summary": "List all product reviews",
  "description": "List of reviews for a specified product. The reviews are returned sorted by submission date, with the most recent reviews appearing first. You can filter the reviews by rating, reviewer, or date for more detailed analysis.",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/operations/list-product-reviews",
    "description": "API reference for the list-product-reviews operation"
  },
  "parameters": [
    {
      "$ref": "#/components/parameters/pageParam"
    },
    {
      "$ref": "#/components/parameters/pageLimitParam"
    },
    {
      "$ref": "#/components/parameters/sortingParam"
    },
    {
      "$ref": "#/components/parameters/searchKeyword"
    },
    {
      "name": "product_id",
      "in": "path",
      "description": "id of a particular product",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "review_tag",
      "in": "query",
      "description": "filter review with review tag",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "message",
              "success",
              "content"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "success": {
                "type": "boolean"
              },
              "content": {
                "properties": {
                  "reviews": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ProductReview"
                    }
                  },
                  "review_tags": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string"
                    }
                  },
                  "pagination": {
                    "$ref": "#/components/schemas/Pagination"
                  }
                },
                "required": [
                  "reviews"
                ],
                "type": "object"
              }
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  },
  "security": [
    {
      "Authorization": []
    }
  ],
  "x-speakeasy-group": "catalog",
  "x-speakeasy-ignore": false,
  "x-speakeasy-name-override": "listProductReviews"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: