This Repo is Only For my Resume!!
- using (webpatser/laravel-uuid) to create uuid for posts table
- using Html Purifier (mews/purifier) to sanitize and clean input data (security and xss)
- All input and output data are Json.
- Route: api/v1/blog/ => Responses all posts as json
- Route: api/v1/blog/show => Outputs One or Array of posts for given uuid's
- Route: api/v1/blog/add => Inserts One or Array of given Posts into database
- Route: api/v1/blog/update => Updates One or Array of Posts
- Route: api/v1/blog/delete => Deletes One or Array of given uuids from database
- Clone or Download Repo
- To install dependencies: composer install
- To create tables : php artisan migrate
- To seed tables : php artisan db:seed
With GET request simply type the url in browser and all posts are returned as Json.
You can set limit
parameter to url for number of records returned from api.
You can move between pages by setting page
parameter in Url
POST uuids in Json format to this route and it will return all the posts with the provided uuids.
{
"uuids":
[
"2019aa37-1aae-40d3-9b7a-c8c77bc56bef",
"3a1b86b6-aea9-44fe-9ffd-a9e9add0bf95"
]
}
POST (Data that you want to save to database) to this route as Json and it will insert these data to database.
{
"data":
[
{
"title":"title1",
"body": "post 1 body!",
"slug": "slug"
},
{
"title":"title2",
"body": "post 2 body!",
"slug": "slug2"
}
]
}
In order to update some posts you should POST a Json data that includes uuid and other attributes for posts table.
{
"data":
[
{
"id":"1050fee5-fc3c-4ec9-9e4f-69a3adf801bb"
"title":"title1",
"body": "post 1 body!",
"slug": "slug"
},
{
"id":"255e7eeb-142e-4777-b54c-503be090820e"
"title":"title2",
"body": "post 2 body!",
"slug": "slug2"
}
]
}
POST uuids Json to this route and all the uuids provided will be deleted from database.
{
"uuids":
[
"2011e883-3ac7-41c9-afdc-facd3fc879ba",
"27bd977d-f3da-4fb6-b862-815d44233f48"
]
}
MIT License.