FastAPI (0.1.0)

Download OpenAPI specification:

users

Get Users

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create User

Request Body schema: application/json
required
name
required
string (Name) [ 2 .. 100 ] characters
email
required
string <email> (Email)
password
required
string (Password) [ 8 .. 24 ] characters

Responses

Request samples

Content type
application/json
{
  • "email": "enrique@gmail.com",
  • "name": "Enrique Pérez",
  • "password": "Contraseña@Segura123"
}

Response samples

Content type
application/json
{
  • "email": "enrique@gmail.com",
  • "id": 1,
  • "name": "Enrique",
  • "registration_date": "21/11/2002"
}

Get User By Email

query Parameters
email
required
string <email> (Email)

Responses

Response samples

Content type
application/json
{
  • "email": "enrique@gmail.com",
  • "id": 1,
  • "name": "Enrique",
  • "registration_date": "21/11/2002"
}

Get User By Id

path Parameters
user_id
required
integer (User Id)

Responses

Response samples

Content type
application/json
{
  • "email": "enrique@gmail.com",
  • "id": 1,
  • "name": "Enrique",
  • "registration_date": "21/11/2002"
}

Update User

path Parameters
user_id
required
integer (User Id)
Request Body schema: application/json
required
Name (string) or Name (null) (Name)
Email (string) or Email (null) (Email)
Password (string) or Password (null) (Password)

Responses

Request samples

Content type
application/json
{
  • "email": "enrique@gmail.com",
  • "name": "Enrique Pérez",
  • "password": "Contraseña@Segura123"
}

Response samples

Content type
application/json
{
  • "email": "enrique@gmail.com",
  • "id": 1,
  • "name": "Enrique",
  • "registration_date": "21/11/2002"
}

Delete User

path Parameters
user_id
required
integer (User Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

auth

Login

Request Body schema: application/x-www-form-urlencoded
required
email
required
string <email> (Email)
password
required
string (Password)

Responses

Response samples

Content type
application/json
{
  • "access_token": "string",
  • "token_type": "bearer"
}

Read Current User

Authorizations:
OAuth2PasswordBearer

Responses

Response samples

Content type
application/json
{
  • "email": "enrique@gmail.com",
  • "id": 1,
  • "name": "Enrique",
  • "registration_date": "21/11/2002"
}

authors

Get Authors

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create Author

Request Body schema: application/json
required
Birthdate (string) or Birthdate (null) (Birthdate)

Date of birth in format dd/mm/yyyy

name
required
string (Name)

Responses

Request samples

Content type
application/json
{
  • "birthdate": "21/11/2002",
  • "name": "Robert Martin"
}

Response samples

Content type
application/json
{
  • "birthdate": "21/11/2002",
  • "id": 0,
  • "name": "Enrique Pérez"
}

Get Author

path Parameters
author_id
required
integer (Author Id)

Responses

Response samples

Content type
application/json
{
  • "birthdate": "21/11/2002",
  • "id": 0,
  • "name": "Enrique Pérez"
}

Update Author

path Parameters
author_id
required
integer (Author Id)
Request Body schema: application/json
required
Birthdate (string) or Birthdate (null) (Birthdate)

Date of birth in format dd/mm/yyyy

Name (string) or Name (null) (Name)

Responses

Request samples

Content type
application/json
{
  • "birthdate": "21/11/2002",
  • "name": "Robert Martin"
}

Response samples

Content type
application/json
{
  • "birthdate": "21/11/2002",
  • "id": 0,
  • "name": "Enrique Pérez"
}

Delete Author

path Parameters
author_id
required
integer (Author Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

books

Get Books

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create Book

Request Body schema: application/json
required
title
required
string (Title) [ 1 .. 100 ] characters
Year Publication (integer) or Year Publication (null) (Year Publication)
author_id
required
integer (Author Id)

Responses

Request samples

Content type
application/json
{
  • "title": "Clean Code",
  • "year_publication": 2008,
  • "author_id": 1
}

Response samples

Content type
application/json
{
  • "author_id": 1,
  • "id": 1,
  • "title": "Clean Code",
  • "user_borrow_id": 2,
  • "year_publication": 2008
}

Search Books

query Parameters
Title (string) or Title (null) (Title)
Example: title=Clean Code
Author Name (string) or Author Name (null) (Author Name)
Example: author_name=Robert Martin
Year (integer) or Year (null) (Year)
Example: year=2008

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get Book By Id

path Parameters
book_id
required
integer (Book Id)

Responses

Response samples

Content type
application/json
{
  • "author_id": 1,
  • "id": 1,
  • "title": "Clean Code",
  • "user_borrow_id": 2,
  • "year_publication": 2008
}

Update Book

path Parameters
book_id
required
integer (Book Id)
Request Body schema: application/json
required
Title (string) or Title (null) (Title)
Year Publication (integer) or Year Publication (null) (Year Publication)
Author Id (integer) or Author Id (null) (Author Id)

Responses

Request samples

Content type
application/json
{
  • "title": "Refactoring",
  • "year_publication": 1999,
  • "author_id": 1
}

Response samples

Content type
application/json
{
  • "author_id": 1,
  • "id": 1,
  • "title": "Clean Code",
  • "user_borrow_id": 2,
  • "year_publication": 2008
}

Delete Book

path Parameters
book_id
required
integer (Book Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Borrow Book

Authorizations:
OAuth2PasswordBearer
path Parameters
book_id
required
integer (Book Id)

Responses

Response samples

Content type
application/json
{
  • "author_id": 1,
  • "id": 1,
  • "title": "Clean Code",
  • "user_borrow_id": 2,
  • "year_publication": 2008
}

Return Book

Authorizations:
OAuth2PasswordBearer
path Parameters
book_id
required
integer (Book Id)

Responses

Response samples

Content type
application/json
{
  • "author_id": 1,
  • "id": 1,
  • "title": "Clean Code",
  • "user_borrow_id": 2,
  • "year_publication": 2008
}