forum app
Authentication through http-header Authentication
Authorization - access token.
Content-Type: application/json - content type.
Allowed parameters:
page, per_page - in case of pagination by pages
cursor, per_page - in case of infinite pagination
Example of successfull response:
{
"users": [
{
"id": 1,
"name": "Paul",
"comments_count": 10,
"updated_at":1627651413,
"avatar_url": null,
"latest_comment": {
"id": 3,
"text": "Hello, bro!"
}
},
{
"id": 2,
"name": "Joe",
"comments_count": 1,
"updated_at":1627651414,
"avatar_url": "/rails/active_storage/representations/eyJfcmFpbHMiOnsib",
"latest_comment": {
"id": 5,
"text": "Awesome forum!"
}
}
],
"page": 2
}avatar_url could be null it means that user hasn't avatar
Other fields should have values(for real usage here could be table with each field description)
Response code: 200
When user unauthorized for this request response code: 401
Authorization - access token.
Content-Type: application/json - content type.
Example of successfull response:
{
"comments": [
{
"id": 5,
"text": "Hello, bro!",
"created_at":1627651413,
"author": {
"id": 1,
"name": "Paul",
"comments_count": 10,
"created_at":1627651413,
}
},
{
"id": 2,
"text": "Awesome forum!",
"created_at":1627651414,
"author": {
"id": 1,
"name": "Joe",
"comments_count": 1,
"created_at":1627651414,
}
}
],
"page": 4
}Response code: 200
Allowed parameters:
page, per_page - in case of pagination by pages.
cursor, per_page - in case of infinite pagination
In all routes we use only restfull resources, so if we need comment likes we do not create /api/v1/comments/liked action
but instead add query parameter to /api/v1/comments action liked=1