Batch Create Comment

🔒

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

  1. Import multiple product reviews at once for efficient management.
  2. Add bulk feedback or testimonials during product updates.
  3. 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 NameTypeRequiredParameter LocationParameter ValueDescription
Access-TokenStringYesHeaderBx-_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-TypeStringYesHeaderapplication
/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 NameTypeMandatoryParameter LocationExample ValueDescription
Request-IdStringYesHeaderBx-_5aV
eXNwl-4AB98s5xLV
yg0fNzGf

MuTpqtlBA
A unique identifier for each request. It helps in identifying and debugging specific requests.
errorStringNoResponse 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

ParameterTypeRequiredExampleDescription
commentsArray of ObjectsYesComments ObjectArray of comments to be submitted in the batch. Each object represents a single comment.
comments.product_idStringYes33f1b4f6-9474-4e6c-9a3f-676a420ea8bbProduct's ID to associate the comment with.
comments.usernameStringYesJoeyUser name for the comment.
comments.starIntegerYes5Star rating for the product. Must be between 1 and 5.
comments.imageStringNohttp://abc.com/img.jpgImages in the comment, separated by semicolons.
comments.likeIntegerYes100Like count for the comment.
comments.created_atStringYes2019-07-10T15:00:00ZComment creation time in ISO 8601 format.
comments.contentStringYesCheap but beautifulContent of the comment.
comments.countryStringNoCNCountry code where the comment is from.

Response Explanation

Successful Response

FieldTypeExampleDescription
success_countInteger2Number of comments successfully processed.
error_countInteger0Number of comments that failed to process.
error_infoArray of ObjectArray of Error Details ObjectDetailed information about each failed comment.

Error Details (error_info Object)

FieldTypeDescriptionExample
product_idStringProduct ID associated with the failed comment.3f1b4f6-9474-4e6c-9a3f-676a420ea8bb
usernameStringUsername associated with the failed comment.test
starIntegerStar rating provided in the failed comment.1
imageArray of StringImage URLs provided in the failed comment.[ "http://abc.com/img.jpg" ]
likeIntegerLike count provided in the failed comment.100
contentStringComment content associated with the failure.Cheap but beautiful
created_atStringTimestamp when the comment was created.2019-07-10T15:00:00Z
error_messageStringError 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.

FieldTypeExampleDescription
errorArray "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 CodeMessagePossible ReasonExample Response
400Bad RequestInvalid input format or request structure (e.g., missing required fields or incorrect data types).Bad Request
UnauthorizedThe request is missing valid authentication credentials or the credentials provided are invalid.Unauthorized
404Invalid or empty store nameinvalid store name{ "errors": store is not active}
200Partial failedSome items in the batch request were processed successfully, while others failed.
review_error_product_not_foundproduct 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
Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!