Create Comment

🔒

Requires write_comments access scope. More access scope

The Create Comment API allows users to add a comment to a specific product. This includes details such as user feedback, star ratings, images, and likes.This API is especially useful for:

  1. Gathering customer feedback for products.
  2. Displaying product reviews on the storefront.3. Tracking user engagement with ratings and comments.

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.



Request Parameters

Public Request Parameters

📘

Public Request Parameters

Body Parameters

Parameter Type Required Example Description
product_id string Yes 33f1b4f6-94... Product's ID to which the comment belongs.
username string Yes Joey User name who posted the comment.
star int32 Yes 5 Rating provided by the user (range: 1 to 5).
image string No http://abc.com/img.jpg;http://def.com/img.jpg URLs of images attached to the comment, separated by semicolons.
like int32 Yes 100 Number of likes for the comment.
created_at string Yes 2019-07-10 15:00:00 Timestamp when the comment was created. Format: YYYY-MM-DD HH:mm:ss.
content string Yes Cheap but beautiful Content of the comment.
country string No CN Country code where the comment was created from (e.g., CN, US).

Response Explanation

Public Response Parameters

📘

Public Response Parameters

Success Response

Field Type Example Description
comment.id integer 23532434 Unique identifier for the comment.
comment.store_id integer 633130 ID of the store where the comment was created.
comment.username string Joey Name of the user who posted the comment.
comment.email string "" Email address of the user (if provided).
comment.star string 5.0 Rating provided by the user (as a string).
comment.like integer 10 Number of likes for the comment.
comment.content string Cheap but beautiful Content of the comment.
comment.img string ["https://photokit.com/features/images/image-text-after.webp"] List of image URLs attached to the comment (JSON string).
comment.status integer 1 Status of the comment: 1: published, 0: unpublished
comment.type integer 1 Type of the comment
comment.product_id string a1a88be0-a1d4-47e4-a2f2-ba6e131cf447 ID of the product associated with the comment.
comment.created_at string 2024-04-24 14:02:39 Timestamp when the comment was created. Format: YYYY-MM-DD HH:mm:ss.
comment.updated_at string 2024-04-25 08:22:58 Timestamp when the comment was last updated.
comment.country string CN Country code where the comment was created from.
comment.is_featured integer 0 Indicates if the comment is featured (0: No, 1: Yes).
comment.is_verified integer 0 Indicates if the comment is verified (0: No, 1: Yes).
comment.client_id null null ID of the client who created the comment (if applicable).
comment.anonymous integer 0 Indicates if the comment was posted anonymously (0: No, 1: Yes).

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
errorsArrayA list of errors encountered during the request processing.
FieldTypeExampleDescription
errorArray "store is not active"Indicates an error encountered during the process.

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}

API Structure Overview

Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!