/api/v1/books/year

GET /api/v1/books/<int:year>

Description

This endpoint allows users to retrieve a list of books based on a specified year (eg: 2012).

Parameters

All parameters are optional, if there is no specific value provided, default will be used.

  • page: Page number for pagination. Default is 1 (int).
  • limit: Number of books per page. Default is 10 (int).
  • sort_type: Type of sorting based on a book characteristic. Default is id (str).
  • sort_order: Sorting order of the results. 1 for ascending and -1 for descending. Default is 1 (int).

Request

Response

The response will show books that match the specified year, with pagination details. For example, if the year is 2012 there will be 2 matching results, two book that were published in the same year (2012).

{
    "books": [
        {
            "_id": "6123d2c4a3490d001f2cf0db",
            "title": "Griffon in Action",
            "publishedDate": "Mon, 04 Jun 2012 07:00:00 GMT",
            // More book information
        },
        {
            "_id": "6123d2c4a3490d001f2cf0dc",
            "title": "Hello! Python",
            "publishedDate": "Mon, 13 Feb 2012 08:00:00 GMT",
            // More book information
        }
    ],
    "pageCurrent": 1,
    "pagePrevious": null,
    "pageNext": null,
    "pageLast": 1,
    "items": 2
}