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.

Persists a new Library record to the database. EF Core assigns the auto-incremented Id after the insert and the controller returns the fully populated object — including the newly generated id — in the response body.

Endpoint

POST /api/libraries

Authentication

No authentication is required. The Add action does not carry an [Authorize] attribute.

Request Body

Send a JSON object with the following fields. The Content-Type header must be application/json.
name
string
required
The human-readable name for the new library (e.g. "Central City Library").
location
string
required
The physical address or location description of the library (e.g. "2838 Violet Ct, Columbus, IN 47201, USA").

Response

200 OK

The controller calls Ok(l) after a successful insert, so the response status is 200 (not 201). The response body contains the newly created Library object, including the database-assigned id.
id
integer
Auto-generated primary key assigned by the database during the insert.
name
string
The name provided in the request body.
location
string
The location provided in the request body.

Status Codes

StatusMeaning
200OK — library created; the new Library object (with id) is returned.

Example Request

curl -X POST https://localhost:7098/api/libraries \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Library name",
    "location": "2838 Violet Ct, Columbus, IN 47201, USA"
  }'

Example Response

{
  "id": 5,
  "name": "Library name",
  "location": "2838 Violet Ct, Columbus, IN 47201, USA"
}

Build docs developers (and LLMs) love