Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/marchena96/Paradigma-lab1/llms.txt

Use this file to discover all available pages before exploring further.

This endpoint returns all books belonging to the library identified by libraryId. Before returning results, the service validates that a library with the given ID exists in the database. If no matching library is found, the endpoint returns 404 Not Found. If the library exists but has no books, a 200 OK response with an empty array is returned.

Endpoint

GET /api/libraries/{libraryId}/books The controller is registered under the route template api/libraries/{libraryId}/[controller], where [controller] resolves to books (the name of BooksController).

Authentication

No authentication is required for this endpoint. There is no [Authorize] attribute on the GetAll action.

Path Parameters

libraryId
integer
required
The unique identifier of the library whose books should be retrieved.

Status Codes

StatusMeaning
200 OKThe library exists; the response body contains the array of books (may be empty).
404 Not FoundNo library with the supplied libraryId exists.

Response Fields

id
integer
The auto-generated primary key of the book.
name
string
The title of the book.
category
string
The genre or category of the book. Empty string if none was provided at creation.
libraryId
integer
The ID of the library this book belongs to.

Example Request

curl https://localhost:7098/api/libraries/5/books

Example Response

[
  {"id": 3, "name": "The Norton Anthology of English Literature", "category": "Anthology", "libraryId": 5},
  {"id": 10, "name": "Inception", "category": "Thriller", "libraryId": 5}
]

Controller Source

[HttpGet]
public async Task<IActionResult> GetAll(int libraryId)
{
    var library = (await _librariesService.Get(new[] { libraryId })).FirstOrDefault();
    if (library == null)
        return NotFound();

    var books = await _booksService.Get(libraryId, null);
    return Ok(books);
}

Build docs developers (and LLMs) love