Create a comment for an article

POST /articles/{slug}/comments

Create a comment for an article. Auth is required

Path parameters

  • slug string Required

    Slug of the article that you want to create a comment for

application/json

Body Required

Comment you want to create

  • comment object Required
    Hide comment attribute Show comment attribute object

Responses

  • 200 application/json

    OK

    Hide response attribute Show response attribute object
  • Unauthorized

  • 422 application/json

    Unexpected error

    Hide response attribute Show response attribute object
    • errors object Required
      Hide errors attribute Show errors attribute object
POST /articles/{slug}/comments
curl \
 --request POST '/api/articles/{slug}/comments' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"comment":{"body":"string"}}'
Request examples
{
  "comment": {
    "body": "string"
  }
}
Response examples (200)
{
  "comment": {
    "id": 1,
    "body": "It takes a Jacobian",
    "author": {
      "bio": "I work at State Farm.",
      "image": "https://i.stack.imgur.com/xHWG8.jpg",
      "username": "jake",
      "following": false
    },
    "createdAt": "2021-02-18T03:22:56.637Z",
    "updatedAt": "2021-02-18T03:22:56.637Z"
  }
}
Response examples (422)
{
  "errors": {
    "body": [
      "string"
    ]
  }
}