GET /books/:id/reviews

This returns all of the reviews that have been written about a specific book

Endpoint URL

http://127.0.0.1:8080/api/books/:id/reviews

Path parameters

Name
Type
Description

id

integer

Unique identifier for each book

Example code

const loadBookReviews = async (id) => {
    try {
        const response = await fetch(`http://127.0.0.1:8080/api/books/${id}/reviews`);
        const reviews = response.json();
        return reviews
    } catch (error) {
        console.error("Error fetching book reviews:", error);
        throw error;
    }
} 

Example response

Response fields

Name
Type
Description

rating

float

A float value rounded to 1 decimal place that rates the book, out of 5 stars

id

integer

The unique id of the review

bookId

integer

A unique identifier, all reviews about the same book will have the same bookId, and can be differentiated using the author property

title

string

The title of the book that is being reviewed

text

string

The review text that the user has written

reviewer

string

The name of the user who posted this review

Last updated