CRUD book API is a task assigned to me by AFTJDIGITAL as a second level of the screening process. The API has the following features
- Register a user
- Login a user
- A user can add a book to a database
- Get all books from a database
- Get a single book from a database
- Delete a book from a database
- Register a user
{
"first_name" : "micheal",
"last_name" : "smith",
"email" : "[email protected]",
"password_confirmation" : "secret@_Password",
"password" : "secret@_Password"
}
{
"status": "success",
"message": "User Account Successfully created",
"data": {
"first_name": "micheal",
"last_name": "smith",
"email": "[email protected]",
"_token": "1|5bfPsdWcztwVSOksyyKcyklaCobhiezUHecU5X0K"
}
}
- Login a user
{
"email" : "[email protected]",
"password" : "secret@_Password",
}
{
"status": "success",
"message": "User Successfully Authenticated",
"data": {
"first_name": "michael",
"last_name": "smith",
"email": "[email protected]",
"_token": "1|5bfPsdWcztwVSOksyyKcyklaCobhiezUHecU5X0K"
}
}
- Create a book
{
"title" : "The Key to Success",
"author" : "Bola Akintomide",
"description" : "An inspirational book ..."
}
{
"status": "success",
"message": "Book creation was successful",
"data": {
"id": "4dd9555fbeffd727805d77a9b33c14d2",
"title": "The Key to Success",
"author": "Bola Akintomide",
"description": "An inspirational book ...",
"creation_date": "2021-02-06 23:05:21",
"created_by": "[email protected]"
}
}
- Retrieve all books
[email protected]
&order=asc
&title=Give%20me%20
&created_at=2021-02-06`
{
"status": "success",
"message": "Books retrieved successfully",
"data": [
{
"id": "ba080edcd4d7287c91506fe303b119ca",
"title": "The Key to Success",
"author": "Bola Akintomide",
"description": "An inspirational book ...",
"creation_date": "2021-02-06 23:05:06",
"created_by": "[email protected]"
},
{
"id": "4dd9555fbeffd727805d77a9b33c14d2",
"title": "Give me the key",
"author": "Roland Great",
"description": "",
"creation_date": "2021-02-06 23:05:21",
"created_by": "[email protected]"
}
]
}
- Find a book
{
"status": "success",
"message": "Found a book with your id",
"data": {
"id": "ba080edcd4d7287c91506fe303b119ca",
"title": "The Key to Success",
"author": "Bola Akintomide",
"description": "An inspirational book ...",
"creation_date": "2021-02-06 23:05:06",
"created_by": "[email protected]"
}
}
- Delete a book
{
"status": "success",
"message": "Book deleted successfully",
"data": {}
}
- Update a book
{
"title" : "The Key to Greatness",
"author" : "Bola Akintomide",
"description" : "An inspirational book ..."
}
{
"status": "success",
"message": "Book update was successful",
"data": {
"id": "ba080edcd4d7287c91506fe303b119ca",
"title": "The Key to Greatness",
"author": "Bola Akintomide",
"description": "An inspirational book ...",
"creation_date": "2021-02-06 23:05:06",
"created_by": "[email protected]"
}
}