List a post's comments
const url = 'https://apibase.ecomweb.app/api/v1/storefront/stores/example/blog/posts/1/comments?limit=100&offset=0';const options = {method: 'GET', headers: {'x-storefront-api-key': '<x-storefront-api-key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://apibase.ecomweb.app/api/v1/storefront/stores/example/blog/posts/1/comments?limit=100&offset=0' \ --header 'x-storefront-api-key: <x-storefront-api-key>'Returns a page of the approved comments on a post, oldest first (limit up to 100, default 100, and offset; the total across all pages is in the X-Total-Count response header), with their reply links in parent_comment_id. With a signed-in customer’s token, that customer’s own comments that are still waiting for approval are included too. Commenters’ emails are never returned; is_approved is. A post that does not exist in the store answers 404.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The post ID.
The store’s ref, as returned by GET /stores.
Query Parameters
Section titled “Query Parameters”Maximum number of comments to return, at least 1 and at most 100. A larger value is lowered to 100. Defaults to 100.
Number of comments to skip. Defaults to 0.
Responses
Section titled “Responses”object
Comment ID.
ID of the post the comment belongs to.
ID of the comment this one replies to, or null for a top-level comment.
Name of the commenter.
Website of the commenter, or null.
Comment text.
Whether the comment is approved and visible on the storefront.
When the comment was created, as an ISO 8601 timestamp.
Example generated
[ { "id": 1, "blog_post_id": 1, "parent_comment_id": 1, "author_name": "example", "author_website": "example", "content": "example", "is_approved": true, "created_at": "example" }]Headers
Section titled “Headers”Total number of comments on the post, across all pages.
The request is malformed or failed validation.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route or on a Storefront route that needs a secret key, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The resource does not exist in this store.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}