- 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
56 lines
1.2 KiB
Plaintext
56 lines
1.2 KiB
Plaintext
meta {
|
|
name: Create/Update Ebook Rating
|
|
type: http
|
|
seq: 7
|
|
}
|
|
|
|
post {
|
|
url: {{base_url}}/api/ebooks/{{ebookid}}/rating
|
|
body: json
|
|
auth: inherit
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"rating": 7
|
|
}
|
|
}
|
|
|
|
settings {
|
|
encodeUrl: true
|
|
timeout: 0
|
|
}
|
|
|
|
docs {
|
|
## Create/Update Ebook Rating
|
|
|
|
Creates or updates the authenticated user's rating for a specific ebook.
|
|
|
|
**Authentication:** Required (Bearer token)
|
|
|
|
**Path Parameters:**
|
|
- `id` (string): Ebook UUID
|
|
|
|
**Request Body:**
|
|
- `rating` (number, required): Rating value (1-10, where odd numbers = half-stars)
|
|
- 1,3,5,7,9 = 0.5,1.5,2.5,3.5,4.5 stars (half-star precision)
|
|
- 2,4,6,8,10 = 1,2,3,4,5 stars (full stars)
|
|
|
|
**Example Request:**
|
|
- `"rating": 7` = 3.5 stars (frontend display)
|
|
- `"rating": 8` = 4.0 stars (frontend display)
|
|
|
|
**Response:**
|
|
- `id` (string): Rating UUID
|
|
- `ebook_id` (string): Ebook UUID
|
|
- `user_id` (string): User UUID
|
|
- `rating` (number): Rating value (1-10)
|
|
- `created_at` (string): Creation timestamp
|
|
- `updated_at` (string): Last update timestamp
|
|
|
|
**Error Responses:**
|
|
- 400: Invalid rating value (must be 1-10)
|
|
- 401: Invalid authentication
|
|
- 404: Ebook not found
|
|
}
|