Profiles, follow, and unfollow
Read a public profile and change the authenticated user's following state.
Use the profile operations to read a user's public profile or change whether the authenticated user follows that profile. A profile contains username, nullable bio, nullable image, and a boolean following value.
Replace ada in the examples with the username you want to address. Profile reads do not declare required security and can be made without a token; follow and unfollow require the Authorization: Token <jwt> header. See Authentication and token usage and Authentication and ownership permissions.
Get a profile
GET /profiles/{username} returns the profile envelope. Authentication is optional, so following can reflect the requesting user when a valid token is supplied.
/profiles/{username}Username of the profile to retrieve.
curl --request GET \ --url https://api.realworld.show/api/profiles/
{ "profile": { "username": "ada", "bio": null, "image": null, "following": false } }curl --request GET \
--url https://api.realworld.show/api/profiles/adaIf you want the response's following value to represent your authenticated relationship, add your token:
curl --request GET \
--url https://api.realworld.show/api/profiles/ada \
--header 'Authorization: Token <jwt>'Follow a user
POST /profiles/{username}/follow follows the named user for the authenticated user and returns the resulting profile.
/profiles/{username}/followUsername of the profile to follow.
curl --request POST \ --url https://api.realworld.show/api/profiles//follow
{ "profile": { "username": "ada", "bio": null, "image": null, "following": true } }curl --request POST \
--url https://api.realworld.show/api/profiles/ada/follow \
--header 'Authorization: Token <jwt>'Unfollow a user
DELETE /profiles/{username}/follow removes the authenticated user's following relationship and returns the resulting profile.
/profiles/{username}/followUsername of the profile to unfollow.
curl --request DELETE \ --url https://api.realworld.show/api/profiles//follow
{ "profile": { "username": "ada", "bio": null, "image": null, "following": false } }curl --request DELETE \
--url https://api.realworld.show/api/profiles/ada/follow \
--header 'Authorization: Token <jwt>'Use the returned profile.following value to confirm the state change. The API contract does not document a separate response for repeating a follow or unfollow, so handle the returned profile and documented errors rather than assuming an idempotency status.
Continue with Read and update the current user or List and filter articles.