Create a blog comment
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/blog/comments';const options = { method: 'POST', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{"blog_post_id":1,"author_name":"example","author_email":"example","author_website":"example","content":"example","parent_comment_id":1,"is_approved":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://apibase.ecomweb.app/api/v1/stores/example/blog/comments \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{ "blog_post_id": 1, "author_name": "example", "author_email": "example", "author_website": "example", "content": "example", "parent_comment_id": 1, "is_approved": true }'Creates a comment on a post on behalf of a commenter, approved by default unless is_approved is false. The post must belong to this store.
Required scopes: write:blog
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The store’s ref, as returned by GET /stores.
Request Bodyrequired
Section titled “Request Bodyrequired”object
ID of the post to comment on.
Name of the commenter, up to 100 characters.
Email of the commenter.
Website of the commenter, up to 255 characters.
Comment text.
ID of the comment this one replies to.
Whether the comment is approved and visible. Comments created through the API are approved unless this is false.
Example generated
{ "blog_post_id": 1, "author_name": "example", "author_email": "example", "author_website": "example", "content": "example", "parent_comment_id": 1, "is_approved": true}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.
Email 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.
Title of the post the comment belongs to. Present on the store-wide comment list only.
Example generated
{ "id": 1, "blog_post_id": 1, "parent_comment_id": 1, "author_name": "example", "author_email": "example", "author_website": "example", "content": "example", "is_approved": true, "created_at": "example", "post_title": "example"}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 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"}