Comments & Favorites
User interactions with libraries including comments and favoriting.
GET /api/libraries/{id}/comments
List comments on a library.
Authentication: Required
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
id | string | Library ID or natural ID |
Response:
{
"_links": {
"self": { "href": "/api/libraries/{id}/comments" }
},
"_embedded": {
"inf:comment": [
{
"id": "comment-abc-123",
"text": "This library contains our latest API documentation",
"username": "alice",
"createdAt": "2024-02-09T10:00:00Z"
}
]
},
"start": 0,
"count": 1,
"total": 1
}
POST /api/libraries/{id}/comments
Add a comment to a library.
Authentication: Required
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
id | string | Library ID or natural ID |
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Comment text |
Example:
{
"text": "Updated with latest documentation"
}
Response:
201 Created
{
"id": "comment-xyz-789",
"text": "Updated with latest documentation",
"username": "alice",
"createdAt": "2024-02-09T11:00:00Z"
}
GET /api/libraries/{id}/favorite
Check if the current user has favorited a library.
Authentication: Required
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
id | string | Library ID or natural ID |
Response:
{
"favorited": true
}
PUT /api/libraries/{id}/favorite
Add a library to the current user's favorites.
Authentication: Required
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
id | string | Library ID or natural ID |
Response:
200 OK
{
"favorited": true
}
DELETE /api/libraries/{id}/favorite
Remove a library from the current user's favorites.
Authentication: Required
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
id | string | Library ID or natural ID |
Response:
204 No Content