- Convert all JSON tests to JavaScript functions for bruToJsonV2 compatibility
- Update authentication to use 'inherit' instead of manual headers
- Fix hardcoded URLs to use {{base_url}} variables
- Standardize variable syntax from {{ _.var }} to {{var}}
- Add comprehensive API documentation to all requests
- Update environment variables with missing required fields
- Apply consistent structure: meta, http method, headers, tests, vars, settings, docs
- Enhanced validation with proper error handling and field checks
50 lines
1.2 KiB
Plaintext
50 lines
1.2 KiB
Plaintext
meta {
|
|
name: Get Ebook Rating
|
|
type: http
|
|
seq: 6
|
|
}
|
|
|
|
get {
|
|
url: {{base_url}}/api/ebooks/{{ebookid}}/rating
|
|
body: none
|
|
auth: inherit
|
|
}
|
|
|
|
settings {
|
|
encodeUrl: true
|
|
timeout: 0
|
|
}
|
|
|
|
docs {
|
|
## Get Ebook Rating
|
|
|
|
Retrieves the authenticated user's rating for a specific ebook.
|
|
|
|
**Authentication:** Required (Bearer token)
|
|
|
|
**Path Parameters:**
|
|
- `id` (string): Ebook UUID
|
|
|
|
**Response when rating exists:**
|
|
- `id` (string): Rating UUID
|
|
- `ebook_id` (string): Ebook UUID
|
|
- `user_id` (string): User UUID
|
|
- `rating` (number): Rating value (1-10, where odd numbers = half-stars)
|
|
- `created_at` (string): Creation timestamp
|
|
- `updated_at` (string): Last update timestamp
|
|
|
|
**Response when no rating exists:**
|
|
- `ebook_id` (string): Ebook UUID
|
|
- `user_id` (string): User UUID
|
|
- `rating` (number): Always 0 (indicates no rating)
|
|
|
|
**Error Responses:**
|
|
- 401: Invalid authentication
|
|
|
|
**Rating System:**
|
|
- Backend: 1-10 scale (odd numbers = half-stars: 1,3,5,7,9)
|
|
- Frontend: 1-5 stars with half-star precision (0.5, 1.5, 2.5, 3.5, 4.5)
|
|
- Example: Backend rating 3 = Frontend display 1.5 stars
|
|
|
|
**Note:** This endpoint returns HTTP 200 with rating 0 when no rating exists, instead of HTTP 404.
|
|
} |