composer install
cp .env.example .env //fill up the db credentials
Use either TestingDatabaseSeeder
or LocalDatabaseSeeder
to seed the database for testing. Use the following command:
php artisan db:seed --class=LocalDatabaseSeeder
The application uses Laravel Passport for its application layer. Run the following to add credentials:
php artisan passport:install
vendor/bin/phpunit
The request headers for API calls are the following:
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer <key from access token endpoint>
The application uses a password credentials grant.
POST oauth/token
Parameters:
- grant_type:password
- client_id:
- client_secret:
- username:
- password:
GET /api/posts
Query String parameters for filtering (all are optional):
- category
- published_date_from
- published_date_to
- status : in draft, published, archived
POST /api/posts
Parameters:
- title : required
- body : required
- status: required, in (draft, published, archived)
- user_id : required
- tags
- category
PUT /api/posts/:id
URL Parameter:
- id - required
Parameters:
- title : required
- body : required
- status: required, in (draft, published, archived)
- user_id : required
- tags
- category
DELETE /api/posts/:id
URL Parameter:
- id - required
GET /api/users
POST /api/users
Parameters:
- email : required
- password : required
- password_confirmation : required
- name : required
- role_id : required
PUT /api/users/:id
URL Parameter:
- id - required
Parameters:
- email : required
- password : required
- password_confirmation : required
- name : required
- role_id : required
DELETE /api/users/:id
URL Parameter:
- id - required