Libraries API Documentation

Documentation for the Libraries REST API endpoint.

Endpoints

GET /api/v1/libraries

Retrieve a list of all libraries.

Query Parameters

Name Type Description
page integer Page number for pagination (default: 1)

Response

{
    "pagination": {
        "total_entries": 25,
        "per_page": 5,
        "current_page": 1,
        "total_pages": 5,
        "next_page": 2,
        "next_page_url": "http://127.0.0.1:3000/api/v1/libraries?page=2"
    },
    "libraries": [
        {
            "id": 1,
            "name": "Classical Collection",
            "description": "A comprehensive collection of classical music",
            "created_at": "2024-08-19T13:30:26.166-05:00",
            "updated_at": "2024-08-19T13:36:56.251-05:00"
        },
        {
            "id": 2,
            "name": "Modern Compositions",
            "description": "Contemporary classical and experimental works",
            "created_at": "2024-08-19T13:30:26.166-05:00",
            "updated_at": "2024-08-19T13:36:56.251-05:00"
        }
    ]
}

Response Fields

Field Type Description
pagination object Contains pagination information
libraries array List of library objects
id integer Unique identifier for the library
name string Name of the library
description string Description of the library’s contents
created_at string Timestamp of when the library was created
updated_at string Timestamp of when the library was last updated

HTTP Response Codes

Code Description
200 OK Successful request
404 Not Found Invalid library ID

GET /api/v1/libraries/{id}

Retrieve details of a specific library.

Path Parameters

Name Type Description Required
id integer ID of the library Yes

Response

{
    "id": 1,
    "name": "Classical Collection",
    "description": "A comprehensive collection of classical music",
    "created_at": "2024-08-19T13:30:26.166-05:00",
    "updated_at": "2024-08-19T13:36:56.251-05:00"
}

HTTP Response Codes

Code Description
200 OK Successful request
404 Not Found Invalid library ID