Library site

Library website API documentation

API key

The default API key is "123" (This is a test key and will be changed later.)

Starting own API from scratch

Make sure pip is installed before continuing.

Install dependencies

Install the dependencies by executing the following line of code in the terminal:

Windows: requirements

Linux(at your own risk): requirementsL

Create databases

Now you can migrate to create databases

Windows: windows

Linux: linux

Create super user

Now you can create a super user via:

Windows: superuserW

Linux: superuserL

Add API keys

Before continuing, you must add API keys and book genres to the database. You can do this in the admin panel

.../admin/

How to fill JSON

JSON POST template

Variable Value
apikey personal api key
title Book title
img link or path to the image
reviews Book rating from 1 to 5
content Book description
upc UPC
producttype Product type
price Price (template XX.XX)
pricetax Price with tax (template XX.XX)
tax Tax (template XX.XX)
availability Number of books (zero if none)
reviewscount Number of reviews
ganres Genres
date Date the book was written (Use YYYY-MM-DD format)
username Username (Max 20 symbols)
email Email (Must hava domain)
password Password (Max 128 symbols)

Get all books from database

To get information about all books you must send a GET request to the address

/api/v1/bookslist/

with the API key in JSON.

Get all books (only brief information)

To get brief information about all books you must send a GET request to the address

/api/v1/bookscard/

with the API key in JSON

Get all books where genre is "..." (only brief information)

To get all books where the genre is "..." you need to make a GET request to the address

api/v1/bookscardganres/

with the API key and genre in json

Get book where title is "..."

To get book where the title is "..." you need to make a GET request to the address

api/v1/bookstitle/

with the API key and title in json

Delete book from databese

To delete a book from the database you must send a DELETE request to the address

api/v1/booksdelete/

with the API key and UPS in JSON

Add a book to the database

To add a book you must send a POST request to the address

/api/v1/booksadd/

with the following information in JSON:

  • apikey
  • title
  • img
  • reviews
  • content
  • upc
  • producttype
  • price
  • pricetax
  • tax
  • availability
  • reviewscount
  • ganres
  • data

Change book information

To change information about a book, send a PUT request to the address

api/v1/booksredact/

with the API key, UPC, and the information you want to change.

User

Here are the queries for working with the user database

Create new user

To create a new user you must send a POST request to the address

api/v1/useradd/

with the API key, username, email and password in JSON

Get information about a user

To get information about a user you must make a GET request to the address

api/v1/usercheck/

with the API key and username in JSON