Book Buddy is a platform where users can browse a wide selection of books. Anyone is welcome to peruse our shelves, but if you log in, you can also reserve a book to borrow!
The URL to access a resource from this API is structured as follows:
https://fsa-book-buddy-b6e748d1380d.herokuapp.com/api
/books
For example, the URL for all books would be:
https://fsa-book-buddy-b6e748d1380d.herokuapp.com/api/books
When using the API, many calls are made in the context of a registered user. The API protects itself by requiring a token string passed in the header for requests made in that context.
The Authorization
header should be a string with the format Bearer token
;
the token is received either by registering or logging in.
Deviating from this format will cause the API to not recognize the token
and will result in an error.
If the token is malformed, missing, or has been revoked, you will get a response specific to that.
firstname | string the first name of the user |
lastname | string the last name of the user |
email required | string the email of the user |
password required | string the password of the user |
message | string the success message |
token | string the JSON Web Token used to authenticate the user for any future requests |
object |
{- "firstname": "Naomi",
- "lastname": "Nagata",
- "email": "naomi@roci.io",
- "password": "krypt0n0rbust"
}
{- "message": "Success!",
- "token": "abcdefghijklmnopqrstuvwxyz",
- "user": {
- "firstname": "Naomi",
- "lastname": "Nagata",
- "email": "naomi@roci.io",
- "id": 1
}
}
email required | string the email of the user |
password required | string the password of the user |
message | string the success message |
token | string the JSON Web Token used to authenticate the user for any future requests |
{- "email": "naomi@roci.io",
- "password": "krypt0n0rbust"
}
{- "message": "Success!",
- "token": "abcdefghijklmnopqrstuvwxyz"
}
firstname | string the first name of the user |
lastname | string the last name of the user |
string the email of the user | |
id | number the database identifier of the user |
Array of objects |
{- "firstname": "Naomi",
- "lastname": "Nagata",
- "email": "naomi@roci.io",
- "id": 1,
- "reservations": [
- {
- "id": 37,
- "title": "Animal Farm",
- "author": "George Orwell",
- "description": "Set on a farm where the animals overthrow their human masters, \"Animal Farm\" is a satirical allegory that tells the story of how power corrupts and how revolutions can end up betraying their original ideals. The novel explores themes of revolution, class struggle, and the dangers of totalitarianism.",
}
]
}
id | number the ID of the book |
title | string the title of the book |
author | string the author of the book |
description | string a brief overview of the book |
coverimage | string a URL to the cover image of the book |
available | boolean whether the book is available to reserve |
[- {
- "id": 37,
- "title": "Animal Farm",
- "author": "George Orwell",
- "description": "Set on a farm where the animals overthrow their human masters, \"Animal Farm\" is a satirical allegory that tells the story of how power corrupts and how revolutions can end up betraying their original ideals. The novel explores themes of revolution, class struggle, and the dangers of totalitarianism.",
- "available": true
}
]
id required | number Example: 37 the ID of the book to retrieve |
id | number the ID of the book |
title | string the title of the book |
author | string the author of the book |
description | string a brief overview of the book |
coverimage | string a URL to the cover image of the book |
available | boolean whether the book is available to reserve |
{- "id": 37,
- "title": "Animal Farm",
- "author": "George Orwell",
- "description": "Set on a farm where the animals overthrow their human masters, \"Animal Farm\" is a satirical allegory that tells the story of how power corrupts and how revolutions can end up betraying their original ideals. The novel explores themes of revolution, class struggle, and the dangers of totalitarianism.",
- "available": true
}
id | number the ID of the reservation |
bookid | number the ID of the reserved book |
title | string the title of the book |
author | string the author of the book |
description | string a brief overview of the book |
coverimage | string a URL to the cover image of the book |
[- {
- "id": 37,
- "title": "Animal Farm",
- "author": "George Orwell",
- "description": "Set on a farm where the animals overthrow their human masters, \"Animal Farm\" is a satirical allegory that tells the story of how power corrupts and how revolutions can end up betraying their original ideals. The novel explores themes of revolution, class struggle, and the dangers of totalitarianism.",
}
]