Installation
- git clone
- composer install
- cp .env.example .env
- php artisan key:generate
- setup database in .env
- php artisan migrate --seed
- php artisan passport:install --force
- php artisan serve
- The site will run localhost:8000
End Point Url
|POST | api/register |
|GET|HEAD | api/user |
|POST | api/login |
|GET|HEAD | api/phonebooks | phonebooks.index |
|POST | api/phonebooks | phonebooks.store |
|GET|HEAD | api/phonebooks/{phonebook} | phonebooks.show |
|PUT|PATCH | api/phonebooks/{phonebook} | phonebooks.update |
|DELETE | api/phonebooks/{phonebook} | phonebooks.destroy |
Support Documentation
-
User Register
Url : {Your_Path}/api/register
Method - POST
Body : row
Data :
{ "name": "Admin", "email":"[email protected]", "password":"password", "c_password":"password" }
The command will return the following format:
{ "success": true, "data": { "token": "eyJ0eXAiOiJKV1QiL.....", "name": "Admin" }, "message": "User register successfully." }
-
User Login
Url : {Your_Path}/api/login
Method - POST
Body : row
Data :
{ "email":"[email protected]", "password":"password" }
The command will return the following format:
{"success":{"token":"eyJ0eXAiOiJKV1QiL..."}}
Note : When you run each API please check the login , if login is available please use the token for authentication , if you do not have the token please login first in each API to receive the token and use the same token in each API with .
Headers
{
"Authorization":"Bearer .$token"
}
-
Index
Url : {Your_Path}/api/phonebooks
Method - GET|HEAD
Body : row
Data : Null
The command will return the following format:
{ "success": true, "data": [ { "id": 1, "firstName": "Laurie", "lastName": "Kovacek", "email": "[email protected]", "mobileNumber": "09573975996", "phoneNumber": "+1-606-729-9793", "created_by": 1, "updated_by": 1, "created_at": "2021-09-03T12:54:26.000000Z", "updated_at": "2021-09-03T12:54:26.000000Z" }, { .... } ], "message": "Phone books retrieved successfully." }
-
Create
Url : {Your_Path}/api/phonebooks
Method - POST
Body : row
Data :
{ "firstName":"Parth", "lastName":"Patel", "email":"[email protected]", "mobileNumber":"07459169377" }
The command will return the following format:
{"success":true,"data":{"firstName":"Parth","lastName":"Patel","email":"[email protected]","mobileNumber":"07459169377","created_by":1,"updated_by":1,"updated_at":"2021-09-03T13:34:18.000000Z","created_at":"2021-09-03T13:34:18.000000Z","id":6},"message":"Phone book details stored successfully."}
-
Read
Url : {Your_Path}/api/phonebooks/{phonebook}
Method - GET|HEAD
Body : row
Data : null
The command will return the following format:
{"success":true,"data":{"id":6,"firstName":"Parth","lastName":"Patel","email":"[email protected]","mobileNumber":"07459169377","phoneNumber":"+1.934.506.1355","created_by":1,"updated_by":1,"created_at":"2021-09-03T13:34:18.000000Z","updated_at":"2021-09-03T14:00:41.000000Z"},"message":"Phone book details retrieved successfully."}
-
Edit
Url : {Your_Path}/api/phonebooks/{phonebook}
Method - PUT|PATCH
Body : row
Data :
{ "firstName":"Parth", "lastName":"Patel", "email":"[email protected]", "mobileNumber":"07459169377", "phoneNumber" : "+1.934.506.1355" }
The command will return the following format:
{"success":true,"data":{"id":6,"firstName":"Parth","lastName":"Patel","email":"[email protected]","mobileNumber":"07459169377","phoneNumber":"+1.934.506.1355","created_by":1,"updated_by":1,"created_at":"2021-09-03T13:34:18.000000Z","updated_at":"2021-09-03T14:00:41.000000Z"},"message":"Phone book updated successfully."}
-
Delete
Url : {Your_Path}/api/phonebooks/{phonebook}
Method - DELETE
Body : row
Data : null
The command will return the following format:
{"success":true,"message":"Phone book deleted successfully."}
Postman
https://github.com/parth11991/Lightflows/blob/main/postman_collection/Laravel-Test-Api.postman_collection.json