Restmancer API - Books

This page documents the available REST endpoints for fetching mock book data such as title, author, genre, and published year.

GET /api/books

Returns fake book data. You can filter by genre, limit the number of records, or select specific fields.

Optional Query Parameters:

  • genre – Genre type (e.g., Fantasy).
  • limit – Number of books to return.
  • fields – Comma-separated list of fields (e.g. title,author,publishedYear).

Examples:

Fields Available

  • id
  • title
  • author
  • genre
  • publishedYear
  • pages
  • publisher
  • description
  • cover
  • availableCopies

You can customize the book response by controlling fields and limit.

Example: GET /api/books?fields=title,author,publishedYear&limit=3

import requests

url = "https://restmancer.vercel.app/api/books"
response = requests.get(url)
print(response.json())
fetch("https://restmancer.vercel.app/api/books")
  .then(res => res.json())
  .then(data => console.log(data));
const axios = require("axios");

axios.get("https://restmancer.vercel.app/api/books")
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error(error);
  });
curl "https://restmancer.vercel.app/api/books"