View Categories

Add a book

< 1 min read

POST/books

Code Samples #

  • 💻 cURL
  • 📄 JavaScript
  • 🐍 Python
  • 🐘 PHP
  • 🔷 C#
  • Java
Copy
curl --request POST \
  --url 'https://api.bookstore.example.com/v1/books' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "title": "The Pragmatic Reader",
    "author_id": 7,
    "genre": "fiction",
    "price": 24.99,
    "in_stock": true
}'

Create A new book.

Request Body #

Content type: application/json

FieldTypeRequiredDescription
titlestringOptional
author_idintegerOptional
genrestringOptional
pricenumberOptional
in_stockbooleanOptional
📋
Example request
Copy
{
    "title": "The Pragmatic Reader",
    "author_id": 7,
    "genre": "fiction",
    "price": 24.99,
    "in_stock": true
}

Responses #

200 — Successful response #

Powered by BetterDocs

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is registered on wpml.org as a development site. Switch to a production site key to remove this banner.