Requires
write_comments
access scope. More access scope
The Batch Create Comment API allows users to create multiple comments for products in a single request. This is especially useful for bulk operations, such as importing customer reviews or adding product feedback in batch.## Use Cases
- Import multiple product reviews at once for efficient management.
- Add bulk feedback or testimonials during product updates.
- Simplify large-scale operations, such as migrating comments to a new store.
Note: The operation is scoped to a specific shop, identified by its unique domain prefix (shopdomain
), ensuring all updates are applied to the correct store.
Public Request Parameters
Parameter Name | Type | Required | Parameter Location | Parameter Value | Description |
---|---|---|---|---|---|
Access-Token | String | Yes | Header | Bx-_5aV eXNwl-4AB98s5xLV yg0fNzGf MuTpqtlBA | Used to authenticate API requests. Obtain an access token from the Access Token Guide. Pass it in the Authorization header for every request. |
Content-Type | String | Yes | Header | application /json | Indicates the media type of the request body. It tells the server how to parse the request and the client how to interpret the response. For more details, visit Content-Type. |
Public Response Parameters
Parameter Name | Type | Mandatory | Parameter Location | Example Value | Description |
---|---|---|---|---|---|
Request-Id | String | Yes | Header | Bx-_5aV eXNwl-4AB98s5xLV yg0fNzGf MuTpqtlBA | A unique identifier for each request. It helps in identifying and debugging specific requests. |
error | String | No | Response Body | { "error": "store is not active" } | Indicates an error encountered during the process. This field typically appears when the Access Token is missing or invalid. Example: { "error": "store is not active" } . |
Error and Errors Clarification:
Added explanation that the error and errors fields are currently dependent on the API implementation, with plans for future unification.
Request Parameters
Body Parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
comments | Array of Objects | Yes | Comments Object | Array of comments to be submitted in the batch. Each object represents a single comment. |
comments.product_id | String | Yes | 33f1b4f6-9474-4e6c-9a3f-676a420ea8bb | Product's ID to associate the comment with. |
comments.username | String | Yes | Joey | User name for the comment. |
comments.star | Integer | Yes | 5 | Star rating for the product. Must be between 1 and 5. |
comments.image | String | No | http://abc.com/img.jpg | Images in the comment, separated by semicolons. |
comments.like | Integer | Yes | 100 | Like count for the comment. |
comments.created_at | String | Yes | 2019-07-10T15:00:00Z | Comment creation time in ISO 8601 format. |
comments.content | String | Yes | Cheap but beautiful | Content of the comment. |
comments.country | String | No | CN | Country code where the comment is from. |
Response Explanation
Successful Response
Field | Type | Example | Description |
---|---|---|---|
success_count | Integer | 2 | Number of comments successfully processed. |
error_count | Integer | 0 | Number of comments that failed to process. |
error_info | Array of Object | Array of Error Details Object | Detailed information about each failed comment. |
Error Details (error_info
Object)
error_info
Object)Field | Type | Description | Example |
---|---|---|---|
product_id | String | Product ID associated with the failed comment. | 3f1b4f6-9474-4e6c-9a3f-676a420ea8bb |
username | String | Username associated with the failed comment. | test |
star | Integer | Star rating provided in the failed comment. | 1 |
image | Array of String | Image URLs provided in the failed comment. | [ "http://abc.com/img.jpg" ] |
like | Integer | Like count provided in the failed comment. | 100 |
content | String | Comment content associated with the failure. | Cheap but beautiful |
created_at | String | Timestamp when the comment was created. | 2019-07-10T15:00:00Z |
error_message | String | Error message explaining why the comment failed to process. | review_error_product_not_found; |
Error Response
Error responses in the API can be represented using two different fields: errors
and error
. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.
Field | Type | Example | Description |
---|---|---|---|
error | Array | "store is not active" | Indicates an error encountered during the process. |
Request Examples
curl --request POST \
--url https://{shopdomain}.myshoplaza.com/openapi/2022-01/comments/batch \
--header 'accept: application/json' \
--header 'access-token: YOUR_ACCESS_TOKEN' \
--header 'content-type: application/json' \
--data '{
"comments": [
{
"product_id": "33f1b4f6-9474-4e6c-9a3f-676a420ea8bb",
"username": "Joey",
"star": 5,
"image": "http://abc.com/img.jpg;http://def.com/img.jpg",
"like": 123,
"created_at": "2019-07-10 15:00:00",
"content": "Cheap but beautiful",
"country": "CN"
},
{
"product_id": "a1a88be0-a1d4-47e4-a2f2-ba6e131cf447",
"username": "Alice",
"star": 4,
"image": "",
"like": 45,
"created_at": "2020-01-01 12:00:00",
"content": "Great product!",
"country": "US"
}
]
}'
Success Response Example
{
"success_count": 2,
"error_count": 0,
"error_info": []
}
}
Error Response Example
{
"error": "store is not active"
}
}
Error Details
Status Code | Message | Possible Reason | Example Response |
---|---|---|---|
400 | Bad Request | Invalid input format or request structure (e.g., missing required fields or incorrect data types). | Bad Request |
Unauthorized | The request is missing valid authentication credentials or the credentials provided are invalid. | Unauthorized | |
404 | Invalid or empty store name | invalid store name | { "errors": store is not active} |
200 | Partial failed | Some items in the batch request were processed successfully, while others failed. | |
review_error_product_not_found | product not found | ||
评论不可为空; | content is required | ||
评分支持输入0.5-5分,最小单位为0.5分 | star must be integer and arranged from 1 - 5. | ||
点赞数必须为大于等于0的整数,且最多8位; | like count must be positive integer and up to 8 digits | ||
用户名不可为空 | empty user name |