GET /books/:id

This returns 1 book, the book which id corresponds to the parameter entered

Endpoint URL

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

Path parameters

Name
Type
Description

id

integer

Unique identifier for each book

Example code

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

Example response

Response fields

Name
Type
Description

_id

integer

This is the identification number, which is unique to each specific book

newrelease

Boolean

A Boolean value to determine whether or not the book is a new release and would therefore show up in the new release section if this is true

title

string

The title of the book

isbn

string

The International Standard Book Number for this specific book

pageCount

integer

The number of pages in the book, all pages are included

publishedDate

date

The date at which this copy of the book was first published

thumbnailUrl

string

Image URL for the thumbnail or cover of the book

shortDescription

string

A short description of the book, acting as a blurb

longDescription

string

A more extensive description which covers the major points of the book

status

string

Whether or not the book is currently published, so far all the books in the library are

authors

array of strings

An array of all authors who contributed to the book

categories

array of strings

The listed genres / categories of the book as all books are non-fiction at the moment

favourited

Boolean

Whether or not the book is a favourite for the user, as no identification system is being used, this is a global property

Last updated