Skip to Content

Blog

Post Comment

Add a comment to a blog article. Requires authentication.

Endpoint

POST /api/blog/articles/{articleId}/comments

Parameters

  • articleId (integer, required): The ID of the article.
  • reply_to (integer, optional): The ID of the parent comment (for replies).
  • comment (string, required): The comment text.

Response

  • 200 OK: Comment added successfully.
  • 404 Not Found: If the article or parent comment does not exist, or if not authenticated.
  • 403 Forbidden: If not logged in.
  • 422 Unprocessable Entity: If required fields are missing.

Example Request

POST /api/blog/articles/123/comments Content-Type: application/x-www-form-urlencoded reply_to=0&comment=Great+post!

Example Response

// No content, just 200 OK


Get Article

Retrieve a single blog article by its ID.

Endpoint

GET /api/blog/articles/{articleId}

Parameters

  • articleId (integer, required): The ID of the article to fetch.

Response

  • 200 OK: Returns the article as JSON.
  • 404 Not Found: If the article does not exist.

Example Request

GET /api/blog/articles/123

Example Response

{ "article": { // ...article fields... } }

Delete Comment

Delete a comment from a blog article. Only the comment owner can delete.

Endpoint

DELETE /api/blog/articles/{articleId}/comments/{commentId}

Parameters

  • articleId (integer, required): The ID of the article.
  • commentId (integer, required): The ID of the comment to delete.

Response

  • 200 OK: Comment deleted successfully.
  • 404 Not Found: If the article or comment does not exist, or if not authenticated.
  • 403 Forbidden: If not the comment owner or not logged in.

Example Request

DELETE /api/blog/articles/123/comments/456

Example Response

// No content, just 200 OK

Last updated on