/api/v1/books

GET /api/v1/books

Retrieves a list of books with pagination.

Parameters

  • 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 with the pagination specified. For example, if the pagination is page 1 and limit 1 there will be only one matching result (and the number of pages will be the number of books). Because the default sort type is "id" and in ascending order it will only show the first book added into the database.

{
    "books": [
        {
            "_id": "6123d2c4a3490d001f2cf0db",
            "id": 1,
            "title": "Unlocking Android",
            // More book information
        }
    ],
    "pageCurrent": 1,
    "pagePrevious": null,
    "pageNext": 2,
    "pageLast": 37,
    "items": 37
}