API is supplied for educational purposes only.
It isn't intended for general public use and may change or be removed without notice.
Information
This API supplies data on a small selection of about 40 books, representing for example an individual's book collection. As this collection is limited, when accessing the books by author or genre, the results only include books in the selected set. While some effort has been made to ensure the data's accuracy, it is not guaranteed.
All requests to this API must use the following base URL:
https://teapi.netlify.app/api/books/{endpoint}
This is a consumption-only API—only the HTTP GET method is available for these resources. Documentation on the available endpoints follows. Throughout the documentation curly braces are used to indicate values that must be substituted.
Resource Lists
Calling any API endpoint without an id will return an array containing the available resources of that type.
Some endpoints support search or filtering. All searches use case-insensitive partial matches on the set of search fields. The set of search fields for each resource is listed in the resource documentation. As the collection is relatively small, this API does not support pagination.
Search is handled using standard query parameters: /{endpoint}?{search-field}={field-value}
.
Root Endpoint: Books
This returns one or more books from the API collection.
Endpoints
- GET
/
- list of Books - GET
/{id}
- single Book
Example
GET https://teapi.netlify.app/api/books/102200
{
"id": 102200,
"title": "The Street",
"firstPublished": "01-01-1946",
"coverImage": "/images/books/the_street_cover.jpg",
"authors": [{"id": 302200, "fullName":"Ann Petry"}],
"genres": [{"id": 2200, "name": "Fiction"}, {"id": 2201, "name": "Historical"}, {"id": 2202, "name": "Classics"}],
"overview": "The Street tells the poignant, often heartbreaking story of Lutie Johnson, a young black woman, and her spirited struggle…"
}
Resource: Book
Name | Description | Type |
id | The id for this resource. | number |
title | The title of the book. | string |
firstPublished | The date when the book was first published. The date is in month-day-year format. If the only the year is known, January 1st is used for the unknown month and day. | date (mm-dd-yyyy) |
coverImage | The path to an image of the book cover. | string |
authors | A list of the book's authors. | list (AuthorReference) |
genres | A list of the book's genres. | list (Genre) |
overview | A paragraph about the book which may include information about the book's significance, plot, or characters. | string |
Search Parameters
- title
- genre
Searching by title returns partial matches. Searching by genre requires an exact match.
Searching with both title and genre performs an AND search. Books must match the title string and a genre.
However, searching with multiple genres does an OR search for the genres, including books with any of the genres specified.
Endpoint: Authors
This returns one or more authors of books from this collection.
Endpoints
- GET
/authors
- list of Authors - GET
/authors/{id}
- single Author
Example
GET https://teapi.netlify.app/api/books/authors/302200
{
"id": 302200,
"fullName": "Ann Petry",
"firstName": "Ann",
"lastName": "Petry",
"image": "/images/authors/ann_petry.jpg",
"birth": "10-12-1908",
"death": "04-28-1997",
"about": "Ann Petry was an American author who became the first black woman writer with book sales topping a million copies…",
"books": []
}
Resource: Author
Name | Description | Type |
id | The id for this resource. | number |
fullName | The full name of this author. | string |
firstName | The first name of this author. | string |
lastName | The last name of this author. | string |
image | The path to an image of the author. | string |
birth | The date when the author was born. The date is in month-day-year format. | date (mm-dd-yyyy) |
death | If not null, the date of the author's death. The date is in month-day-year format. | date (mm-dd-yyyy) |
overview | A paragraph about the author which may include information about the author's accomplishments or notable works. | string |
books | A list of books in this collection written by the author. This property is not included when retrieving multiple authors. It is only included for a single author. | list (Book) |
Search Parameters
- name
Note: This matches any part of the authors full name.
Endpoint: Genres
This returns one or more book genres.
Endpoints
- GET
/genres
- list of Genres - GET
/genres/{id}
- single Genre
Example
GET https://teapi.netlify.app/api/books/genres/2206
{
"id": 2206,
"name": "Poetry",
"books": []
}
Resource: Genre
Name | Description | Type |
id | The id for this resource. | number |
name | The name of this resource. | string |
books | A list of books within this genre. This property is not included when retrieving multiple genres. It is only included for a single genre. | list (Book) |
Search Parameters
Search is not supported for this resource.
Common Types
This section defines common types used by this API.
Type: AuthorReference
Name | Description | Type |
id | The id for this author. | number |
fullName | The author's full name. | string |