Get comments for an article

GET /articles/{slug}/comments

Get the comments for an article. Auth is optional

Path parameters

  • slug string Required

    Slug of the article that you want to get comments for

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
GET /articles/{slug}/comments
curl \
 --request GET '/api/articles/{slug}/comments'
Response examples (200)
{
  "comments": [
    {
      "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"
    ]
  }
}












Unfavorite an article

DELETE /articles/{slug}/favorite

Unfavorite an article. Auth is required

Path parameters

  • slug string Required

    Slug of the article that you want to unfavorite

Responses

DELETE /articles/{slug}/favorite
curl \
 --request DELETE '/api/articles/{slug}/favorite' \
 --header "Authorization: $API_KEY"
Response examples (200)
{
  "article": {
    "slug": "how-to-train-your-dragon",
    "title": "How to train your dragon",
    "description": "Ever wonder how?",
    "body": "It takes a Jacobian",
    "tags": [
      "dragons",
      "training"
    ],
    "createdAt": "2025-05-04T09:42:00Z",
    "updatedAt": "2025-05-04T09:42:00Z",
    "favorited": false,
    "favoritesCount": 42,
    "author": {
      "bio": "I work at State Farm.",
      "image": "https://api.realworld.io/images/smiley-cyrus.jpg",
      "username": "jake",
      "following": false
    }
  }
}
Response examples (422)
{
  "errors": {
    "body": [
      "string"
    ]
  }
}



























Update current user

PUT /user

Updated user information for current user

application/json

Body Required

User details to update. At least one field is required.

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
PUT /user
curl \
 --request PUT '/api/user' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"bio":"I work at State Farm.","email":"jake@jake.jake","image":null,"username":"jake"}'
Request examples
{
  "bio": "I work at State Farm.",
  "email": "jake@jake.jake",
  "image": null,
  "username": "jake"
}
Response examples (200)
{
  "user": {
    "bio": "I work at State Farm.",
    "email": "jake@jake.jake",
    "image": null,
    "token": "jwt.token.here",
    "username": "jake"
  }
}
Response examples (422)
{
  "errors": {
    "body": [
      "string"
    ]
  }
}