API Library
API Library
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 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 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 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 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