0% found this document useful (0 votes)
18 views6 pages

API Library

The document outlines the requirements and endpoints for an API to manage a book catalog. It includes endpoints for user authentication and registration, adding, retrieving, updating and deleting books, and reporting books. It also includes request and response schemas and status codes.

Uploaded by

Italo Renan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views6 pages

API Library

The document outlines the requirements and endpoints for an API to manage a book catalog. It includes endpoints for user authentication and registration, adding, retrieving, updating and deleting books, and reporting books. It also includes request and response schemas and status codes.

Uploaded by

Italo Renan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Free book

requisitos

- [RF000] sign up
- [RF001] sign in
- [RF002] salvar livros (nome, autor, data de lançamento, sinopse, capa, gênero,
editora) login
- [RF003] buscar livros( nome, data de lançamento, editora ou gênero)
- [RF004] pegar livro específico(id)
- [RF005] deletar livro(id) login
- [RF006] denunciar livro(id)

Endpoints

[RF000]

POST /signIn

Request body:

{
“userName”: “user”,
“email”:”[email protected]”,
“password”: “12345678”
}

Response;

status 201:

{
“token”: “jwt”
}

status 400:

{
“status”: 400
“error”: ”email is empty”
}

status 500:

{
“status”:500
“error”:”Server error”
}

[RF001]

POST /signUp

Request body:

{
“email”:”[email protected]”,
“password”: “12345678”
}

Response;

status 201:

{
“token”: “jwt”
}

status 400:

{
“status”: 400
“error”: ”email is empty”
}

status 404:

{
“status”: 404
“error”: ”user not found”
}

status 500:

{
“status”:500
“error”:”Server error”
}

[RF002]

GET /confirm/{token}
Response;

status 204 no content

status 500:

{
“status”:500
“error”:”Server error”
}

[RF002]

POST /books

Request body:

{
“name”: “Manual de animação”,
“writer”: “Richard Williams”,
“release_date”: “3 junho 2016”,
“synopsis”: “fjhdfçkjdsbfjdsfçjdshfçjdshpkdj”,
“cover”: file,
“genres”: ”informativo”,
“publisher”: “ Senac São Paulo”
}

Response:

status 201: no content

status 400:

{
“status”:400
“error”:”name is empty”
}

status 401:

{
“status”:401
“error”:”user authorized”
}

status 500:
{
“status”:500
“error”:”Server error”
}

[RF002]

GET /books/{param}

Response:

status 200:
[
{
“id”: 1
“name”: “Manual de animação”,
“writer”: “Richard Williams”,
“release_date”: “3 junho 2016”,
“synopsis”: “fjhdfçkjdsbfjdsfçjdshfçjdshpkdj”,
“cover”: file,
“genres”: ”informativo”,
“publisher”: “ Senac São Paulo”
},
{…
]
ou
[]

status 500:

{
“status”:500
“error”:”Server error”
}

[RF004]

GET /book/{id}

Response:

status 200:
{
“id”: 1
“name”: “Manual de animação”,
“writer”: “Richard Williams”,
“release_date”: “3 junho 2016”,
“synopsis”: “fjhdfçkjdsbfjdsfçjdshfçjdshpkdj”,
“cover”: file,
“genres”: ”informativo”,
“publisher”: “ Senac São Paulo”
}

status 404:

{
“status”:404
“error”:”book not found”
}

status 500:

{
“status”:500
“error”:”Server error”
}

[RF005]

DELETE /books/{id}

Response:

status 204: no-content

status 404:

{
“status”:404
“error”:”book not found”
}

status 500:

{
“status”:500
“error”:”Server error”
}

[RF006]

POST /books/report
Request body:

{
“book_id”: 1
“message”: “malicious book”
}

Response:

status 204: no-content

status 404:

{
“status”:404
“error”:”book not found”
}

status 500:

{
“status”:500
“error”:”Server error”
}

Schemas:

Users:
- id string
- username string
- password string

Confirmations:
- id int
- token string
- user user
- createAt time

Books:
- id int
- name string
- writer string
- synopsis string
- publisher string
- genders string
- release_date date
- cover string
- user_id string

You might also like