create-marketplace-product-review
Method: POST
Path: /catalog/marketplace/products/{product_id}/reviews
Tags: Marketplace catalog
Summary
Create product review
Description
Submit a marketplace review as the current session user. A supplied user_id is ignored. New reviews await approval and are not featured. Images and videos accept uploads or existing file IDs.
Storefront SDK Usage
SDK Method: sdk.catalog.createMarketplaceProductReview()
Example:
const { data, error } = await sdk.catalog.createMarketplaceProductReview({"product_id": "product-id-123"}, {"order_number": "ORD-001", "rating": 5, "review_text": "Excellent product"});TypeScript Definition
"create-marketplace-product-review": {
parameters: {
query?: never;
header?: never;
path: {
/** @description id of a particular product */
product_id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": {
order_number: $Write<string>;
rating: number;
/** @default */
review_text?: string;
images?: string[];
videos?: string[];
name?: string;
/** @description Optional reviewer email. An empty string is also accepted. */
email?: string | "";
tags?: string[];
/**
* Format: date-time
* @description Defaults to the submission time.
*/
review_date?: string;
/** @description Ignored when supplied. The current session user is always the author. */
user_id?: unknown;
};
"application/x-www-form-urlencoded": {
order_number: $Write<string>;
rating: number;
/** @default */
review_text?: string;
images?: string[];
videos?: string[];
name?: string;
/** @description Optional reviewer email. An empty string is also accepted. */
email?: string | "";
tags?: string[];
/**
* Format: date-time
* @description Defaults to the submission time.
*/
review_date?: string;
/** @description Ignored when supplied. The current session user is always the author. */
user_id?: unknown;
};
"multipart/form-data": components["schemas"]["CreateMarketplaceReview"];
};
};
responses: {
/** @description Success response */
201: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
/** @example Review submitted successfully. */
message: string;
success: boolean;
content: {
review: components["schemas"]["CreatedReview"];
};
};
};
};
/** @description Invalid rating, missing order number, more than four images or one video, invalid media IDs, unsupported files or failed uploads. */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
code?: string;
errors?: {
[key: string]: unknown;
} | string;
content?: {
[key: string]: unknown;
};
};
};
};
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
500: components["responses"]["InternalServerError"];
504: components["responses"]["GatewayTimeout"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["CreateMarketplaceReview"] | CreateMarketplaceReview |
components["schemas"]["CreatedReview"] | CreatedReview |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["NotFound"] | NotFound |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
Parameters
- product_id (path): id of a particular product
Request Body
Content Types: application/json, application/x-www-form-urlencoded, multipart/form-data
Responses
201
Success response
400
Invalid rating, missing order number, more than four images or one video, invalid media IDs, unsupported files or failed uploads.
401
Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.
403
Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.
404
Requested resource not found
500
The request failed because of an unexpected error.
504
The request timed out.
OpenAPI Definition
{
"tags": [
"Marketplace catalog"
],
"operationId": "create-marketplace-product-review",
"summary": "Create product review",
"description": "Submit a marketplace review as the current session user. A supplied user_id is ignored. New reviews await approval and are not featured. Images and videos accept uploads or existing file IDs.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/create-marketplace-product-review",
"description": "API reference for the create-marketplace-product-review operation"
},
"parameters": [
{
"name": "product_id",
"in": "path",
"description": "id of a particular product",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"description": "Review authorship always uses the current session user. A supplied user_id is ignored.",
"type": "object",
"required": [
"order_number",
"rating"
],
"properties": {
"order_number": {
"type": "string",
"maxLength": 64,
"minLength": 1,
"pattern": "\\S",
"writeOnly": true
},
"rating": {
"type": "number",
"maximum": 5,
"minimum": 1,
"multipleOf": 0.5
},
"review_text": {
"type": "string",
"default": ""
},
"images": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "\\S",
"description": "Existing file ID. Use multipart/form-data to upload a file."
},
"maxItems": 4
},
"videos": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "\\S",
"description": "Existing file ID. Use multipart/form-data to upload a file."
},
"maxItems": 1
},
"name": {
"type": "string",
"maxLength": 128
},
"email": {
"description": "Optional reviewer email. An empty string is also accepted.",
"anyOf": [
{
"type": "string",
"format": "email"
},
{
"type": "string",
"const": ""
}
]
},
"tags": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
}
},
"review_date": {
"description": "Defaults to the submission time.",
"type": "string",
"format": "date-time"
},
"user_id": {
"description": "Ignored when supplied. The current session user is always the author."
}
}
}
},
"application/x-www-form-urlencoded": {
"schema": {
"description": "Review authorship always uses the current session user. A supplied user_id is ignored.",
"type": "object",
"required": [
"order_number",
"rating"
],
"properties": {
"order_number": {
"type": "string",
"maxLength": 64,
"minLength": 1,
"pattern": "\\S",
"writeOnly": true
},
"rating": {
"type": "number",
"maximum": 5,
"minimum": 1,
"multipleOf": 0.5
},
"review_text": {
"type": "string",
"default": ""
},
"images": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "\\S",
"description": "Existing file ID. Use multipart/form-data to upload a file."
},
"maxItems": 4
},
"videos": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "\\S",
"description": "Existing file ID. Use multipart/form-data to upload a file."
},
"maxItems": 1
},
"name": {
"type": "string",
"maxLength": 128
},
"email": {
"description": "Optional reviewer email. An empty string is also accepted.",
"anyOf": [
{
"type": "string",
"format": "email"
},
{
"type": "string",
"const": ""
}
]
},
"tags": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
}
},
"review_date": {
"description": "Defaults to the submission time.",
"type": "string",
"format": "date-time"
},
"user_id": {
"description": "Ignored when supplied. The current session user is always the author."
}
}
}
},
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/CreateMarketplaceReview"
}
}
}
},
"responses": {
"201": {
"description": "Success response",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"properties": {
"message": {
"type": "string",
"examples": [
"Review submitted successfully."
]
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"review": {
"$ref": "#/components/schemas/CreatedReview"
}
},
"required": [
"review"
],
"type": "object"
}
}
}
}
}
},
"400": {
"description": "Invalid rating, missing order number, more than four images or one video, invalid media IDs, unsupported files or failed uploads.",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success"
],
"properties": {
"message": {
"type": "string",
"x-speakeasy-error-message": true
},
"success": {
"type": "boolean"
},
"code": {
"type": "string"
},
"errors": {
"anyOf": [
{
"type": "object",
"additionalProperties": true
},
{
"type": "string"
}
]
},
"content": {
"additionalProperties": true,
"type": "object"
}
}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
},
"504": {
"$ref": "#/components/responses/GatewayTimeout"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "marketplace",
"x-speakeasy-ignore": true,
"x-speakeasy-name-override": "createProductReview"
}Auto-generated from OpenAPI spec and TypeScript definitions