Clone the repository
git clone https://github.com/gregmiaritis/bookAPI.git
Switch to the repo folder
cd bookAPI
Install all the dependencies using composer
composer install
Copy the example env file and make the required configuration changes in the .env file
cp .env.example .env
Generate a new application key
php artisan key:generate
Run migrations
php artisan migrate
Passport Install
php artisan passport:install
Database Seeding
composer dump-autoload
php artisan db:seed --class=CategoriesTableSeed
php artisan db:seed --class=BooksTableSeed
Required | Key | Value |
---|---|---|
Yes | Content-Type | application/json |
Yes | Accept | application/json |
Yes | Authorization | Bearer {Token} |
POST /api/register
{
"name": "Greg Miaritis",
"email": "greg@greg.com",
"password": "123456",
"c_password": "123456"
}
Required fields: name
, email
, password
, c_password
POST /api/login
Example request body:
{
"email": "greg@greg.com",
"password": "123456"
}
Required fields: email
, password
POST /api/books
{
"isbn": "978-1491905012",
"title": "Modern PHP: New Features and Good Practices",
"author": "Josh Lockhart",
"category": [
"PHP"
],
"price": 18.99
}
Required fields: isbn
, title
, author
, price
Optional fields: category
GET /api/books
Authentication required
Post /api/books
Authentication required
GET /api/categories
Authentication required
api/books?filter[author]=Robin Nixon
api/books?filter[categories]=linux
api/books?sort=author
api/books?sort=price
api/books?sort=title
api/books?filter[author]=Robin Nixon&filter[categories]=linux
Custom filter has been applied on Laravel Query Builder