REST API service wrapper over the New York Times Best Sellers History API. Provides simplified access to NYT best sellers data with filtering capabilities.
- Search for books by author, ISBN, and title
- Page-by-page navigation of results
- Query caching for performance optimization
- API uses Laravel Form Requests for validation
- Request caching implemented
- Covered by tests, including edge cases
- Supports tests without internet and API key
Get the list of best-sellers with filtering.
Query parameters:
author(string, optional) - filter by author nameisbn[](array of strings, optional) - filter by ISBNtitle(string, optional) - filter by book titleoffset(integer, optional) - offset for pagination, by default 0
Query example:
curl -X GET 'http://localhost:8000/api/v1/best-sellers?author=Stephen+King&offset=0'Example Answer:
{
"status": "success",
"data": [
{
"title": "The Stand",
"author": "Stephen King",
"isbn": "978-0307743688",
"publisher": "Anchor",
"rank": 1
}
],
"meta": {
"total": 1,
"offset": 0
}
}- Clone repository
- Run
make install - Fillout
NYT_API_KEY - Run
make test
- Run
composer install - copy
.env.exampleand rename to.env - Run
php artisan key:generate - Fill out
NYT_API_KEYenvironment variables- Create an account at NYT Developer
- Create a new app: https://developer.nytimes.com/my-apps/new-app
- Enable Books API
- Copy the API key into the
.envfile:
- Run
php artisan testto run tests