Bookstore API

Generated from the OpenAPI contract for version 1.2.3.

This API documentation is a live demo of the periwinkle project, a static documentation generator for OpenAPI 3.x contracts. The Bookstore API described below is a neutral example contract invented for this demo, and none of its endpoints actually exist.

About this demo

This site is the living demo of periwinkle, a static API documentation generator for OpenAPI 3.x. It is built from a fictional bookstore contract on every push to main.

Get the source and usage instructions at github.com/phranck/periwinkle.

Integration guide

Integration essentials

Authentication

Never expose credentials in browser code.

  • Send the X-API-Key header with every request (scheme ApiKeyAuth). API key issued per account.
  • Send an Authorization: Bearer <token> header with every request (scheme BearerAuth). OAuth access token.

Requests

Use JSON request bodies and read JSON responses from https://api.bookstore.example.

Errors

Errors use standard HTTP status codes. Each operation below documents its error responses.

Rate limits

This is a demo deployment of a fictional API, so there are no real rate limits.

Versioning

This reference is generated from API version 1.2.3.

OpenAPI contract

The public OpenAPI contract is available at /periwinkle/openapi.json.

Authenticated request

# Requires the API key to be set in your shell environment.
curl https://api.bookstore.example/resource \
  -H "X-API-Key: ${API_KEY}" \
  -H "Content-Type: application/json"

Public OpenAPI contract, v1.2.3

Loading OpenAPI contract

Books

Browse and manage books.

All books

GET/books Authentication required

List all books

Parameters

limitquery
Maximum number of books to return.

Responses

200
A page of books.
Content-Type:application/json

Example request

curl "https://api.bookstore.example/books" \
  -H "X-API-Key: $API_KEY"

Create Book

POST/books Authentication required

Create a book

Request body

The book to create.

application/jsonBookInput

Responses

201
The created book.
Content-Type:application/jsonResponse Object:Book
400
Validation failed.
Content-Type:application/jsonResponse Object:ErrorResponse

Example request

curl -X POST "https://api.bookstore.example/books" \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Fetch a single book

GET/books/{id}Public endpoint

Fetch a single book, with reviews included (verbose)

Parameters

idpathRequired
Book identifier.

Responses

200
The requested book.
Content-Type:application/jsonResponse Object:Book
404
Not found.

Example request

curl "https://api.bookstore.example/books/{id}"

Authors

Author directory.

List Authors

GET/authorsDeprecated Authentication required

List all authors

Responses

200
All authors.
Content-Type:application/json

Example request

curl "https://api.bookstore.example/authors" \
  -H "X-API-Key: $API_KEY"

Other

Search

Schemas

Author

A book author.

KeyKey PresenceValue TypeDescription
idincludedintegerNone
nameincludedstringNone
websiteoptionalstring | nullNone
Book

A single book in the catalogue.

KeyKey PresenceValue TypeDescription
idincludedintegerUnique identifier.
titleincludedstringDisplay title.
authoroptionalAuthorA book author.
idincludedintegerNone
nameincludedstringNone
websiteoptionalstring | nullNone
categoryoptionalCategoryHierarchical catalogue category.
idincludedintegerNone
nameincludedstringNone
parentoptionalCategoryHierarchical catalogue category.
tagsoptionalstring[]None
ratingoptionalnumber | nullAverage rating, when rated.
BookInput
KeyKey PresenceValue TypeDescription
authorIdoptionalintegerNone
titleincludedstringNone
Category

Hierarchical catalogue category.

KeyKey PresenceValue TypeDescription
idincludedintegerNone
nameincludedstringNone
parentoptionalCategoryHierarchical catalogue category.
idincludedintegerNone
nameincludedstringNone
parentoptionalCategoryHierarchical catalogue category.
ErrorResponse
KeyKey PresenceValue TypeDescription
codeincludedstringNone
messageincludedstringNone
SearchResult

Either a book or an author.

Variants

Search API reference

Search ready

Type to search the complete API reference.