This endpoint adds a new book to the library identified byDocumentation 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.
libraryId. The libraryId is taken from the URL route — it is not read from the request body. The request body must include a name; a category is optional and defaults to an empty string when omitted. On success the endpoint returns 201 Created with the newly created book in the response body. If no library with the given libraryId is found, the endpoint returns 404 Not Found.
Endpoint
POST /api/libraries/{libraryId}/books
Authentication
No authentication is required for this endpoint. There is no[Authorize] attribute on the Add action.
Path Parameters
The unique identifier of the library to which the new book will be added.
Request Body
The title of the book to add.
The genre or category of the book. Optional — defaults to an empty string (
"") if omitted.Status Codes
| Status | Meaning |
|---|---|
201 Created | Book was successfully added; the response body contains the new book object. |
404 Not Found | No library with the supplied libraryId exists. |
Response Fields
The auto-generated primary key assigned to the new book.
The title of the newly created book.
The genre or category of the book. Empty string if not provided in the request.
The ID of the library this book was added to. This is always the value taken from the URL route parameter, not the request body.
Example Request
Example Response
When
category is omitted from the request body, the service assigns it an empty string (""). This is required because the Category column in PostgreSQL is NOT NULL — a null value would violate the database constraint.