PDI Books API (1.0.0)

Download OpenAPI specification:

A RESTful API for managing a book collection in Program Design and Implementation I.

Welcome message

Responses

Response samples

Content type
application/json
{
  • "message": "Welcome to book collection API for Program Design and Implementation I"
}

List all books

Returns all books in the collection. Use query parameters to filter results.

Example searches:

  • /books?title=gatsby - Find books with "gatsby" in the title
  • /books?author=klune - Find books by Klune
  • /books?genre=fantasy - Find fantasy books
  • /books?author=bennett&genre=literary - Combine filters
query Parameters
title
string
Example: title=pachinko

Filter by title (case-insensitive partial match)

author
string
Example: author=klune

Filter by author (case-insensitive partial match)

genre
string
Example: genre=fantasy

Filter by genre (case-insensitive partial match)

Responses

Response samples

Content type
application/json
Example
[
  • {
    },
  • {
    },
  • {
    }
]

Create a new book

Authorizations:
bearerAuth
Request Body schema: application/x-www-form-urlencoded
required
title
string

Book title

author
string

Author name

year
integer

Publication year

genres
string

Comma-separated list of genres

isbn
string

ISBN number

stock
integer

Available stock quantity

Responses

Response samples

Content type
application/json
{
  • "id": 22,
  • "title": "Tomorrow, and Tomorrow, and Tomorrow",
  • "author": "Gabrielle Zevin",
  • "year": 2022,
  • "genres": [
    ],
  • "isbn": "978-0735243347",
  • "stock": 5
}

Get a book by ID

path Parameters
id
required
integer

The book ID

Responses

Response samples

Content type
application/json
{
  • "id": 1,
  • "title": "Pachinko",
  • "author": "Min Jin Lee",
  • "year": 2017,
  • "genres": [
    ],
  • "isbn": "978-1455563920",
  • "stock": 14
}

Update a book

Authorizations:
bearerAuth
path Parameters
id
required
integer

The book ID

Request Body schema: application/x-www-form-urlencoded
required
title
string

Book title

author
string

Author name

year
integer

Publication year

genres
string

Comma-separated list of genres

isbn
string

ISBN number

stock
integer

Available stock quantity

Responses

Response samples

Content type
application/json
{
  • "id": 1,
  • "title": "Pachinko",
  • "author": "Min Jin Lee",
  • "year": 2017,
  • "genres": [
    ],
  • "isbn": "978-1455563920",
  • "stock": 14
}

Delete a book

Authorizations:
bearerAuth
path Parameters
id
required
integer

The book ID

Responses

Response samples

Content type
application/json
{
  • "error": "Book not found"
}

List all unique authors

Returns a sorted list of unique author names from all books.

Responses

Response samples

Content type
application/json
[
  • "Arundhati Roy",
  • "Brit Bennett",
  • "Chimamanda Ngozi Adichie",
  • "Kaliane Bradley",
  • "Kristin Hannah",
  • "Michelle Zauner",
  • "Min Jin Lee",
  • "Ocean Vuong",
  • "Silvia Moreno-Garcia",
  • "Susanna Clarke",
  • "TJ Klune",
  • "Yaa Gyasi"
]

Get books by author

Returns all books by a specific author. Author name must be URL-encoded.

path Parameters
name
required
string
Example: Susanna%20Clarke

The author's name (URL-encoded)

Responses

Response samples

Content type
application/json
[
  • {
    }
]