Este é o back-end da aplicação cujo objetivo é encontrar receitas que aproveitem ao máximo os ingredientes disponíveis em casa. Além disso, o usuário pode ver publicações no feed tal como cadastrá-las, editá-las e deletá-las.
A URL base desta API encontra-se em: https://capstone-json.herokuapp.com/
POST /users - FORMATO DA REQUISIÇÃO
{
"email": "[email protected]",
"password": "987654321",
"username": "johnjohn",
"profile": "https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fcdn.onlinewebfonts.com%2Fsvg%2Fimg_132120.png&f=1&nofb=1"
}
Esperamos a seguinte resposta positiva:
POST /users - FORMATO DA RESPOSTA - STATUS 201
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImpvbmRvZUBtYWlsLmNvbSIsImlhdCI6MTY0MzY2NTI4NSwiZXhwIjoxNjQzNjY4ODg1LCJzdWIiOiIxMCJ9.tae-IFm75M8AYzlBSwjwnqvDbwrcykdo7jHrZoQPe_0",
"user": {
"email": "[email protected]",
"username": "johnjohn",
"profile": "https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fcdn.onlinewebfonts.com%2Fsvg%2Fimg_132120.png&f=1&nofb=1",
"id": 10
}
}
PATCH /users/:id - FORMATO DA REQUISIÇÃO
{
"profile": "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fstatic.vecteezy.com%2Fsystem%2Fresources%2Fpreviews%2F000%2F571%2F419%2Foriginal%2Fvector-network-icon.jpg&f=1&nofb=1"
}
Esperamos a seguinte resposta:
PATCH /users/:id - FORMATO DA RESPOSTA - STATUS 200
{
"email": "[email protected]",
"password": "$2a$10$kqXOyfz5MGUIhCuOovkbWODmDGtn2/6eGvaTigUBRf0QRK56RWy3i",
"username": "johnjohn",
"profile": "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fstatic.vecteezy.com%2Fsystem%2Fresources%2Fpreviews%2F000%2F571%2F419%2Foriginal%2Fvector-network-icon.jpg&f=1&nofb=1",
"id": 10
}
POST /login - FORMATO DA REQUISIÇÃO
{
"email": "[email protected]",
"password": "987654321"
}
Esperamos a seguinte resposta caso esteja correto:
POST /login - FORMATO DA RESPOSTA - 200 OK
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImpvbmRvZUBtYWlsLmNvbSIsImlhdCI6MTY0MzA1NDk2OCwiZXhwIjoxNjQzMDU4NTY4LCJzdWIiOiIzIn0.neNCWA9WR9CZO6E2Y0IzEUQaECfFqaYz03MQHCXKOy8",
"user": {
"email": "[email protected]",
"id": 3
}
}
O usuário precisa estar logado para ter acesso, cadastrar, editar e deletar.
GET /publications - FORMATO DA REQUISIÇÃO
Nós receberemos a seguinte resposta:
GET /publications - 200 OK
[
{
"userId": 3,
"icon": "",
"username": "",
"photo": "",
"category": "",
"description": "",
"id": 1
},
{
"userId": 3,
"icon": "",
"username": "",
"photo": "",
"category": "Lorem",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"id": 2
},
{
"userId": 3,
"icon": "",
"username": "",
"photo": "",
"category": "Lorem",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"id": 3
},
{
"userId": 5,
"icon": "",
"username": "",
"photo": "",
"category": "Lorem",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"id": 4
}
]
POST /publications - FORMATO DA REQUISIÇÃO
{
"userId": 5,
"icon": "",
"username": "",
"photo": "",
"category": "Lorem",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna."
}
Esperamos a seguinte resposta caso dê tudo certo:
POST/ publications - FORMATO DA RESPOSTA - 201 created
{
"userId": 5,
"icon": "",
"username": "",
"photo": "",
"category": "Lorem",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"id": 4
}
PATCH /publications/:id - FORMATO DA REQUISIÇÃO
{
"userId": 5,
"icon": "",
"username": "",
"photo": "",
"category": "Lorem ipsum",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"id": "4"
}
Esperamos a seguinte resposta:
PATCH /publications/:id - FORMATO DA RESPOSTA - 200 OK
{
"userId": 5,
"icon": "",
"username": "",
"photo": "",
"category": "Lorem ipsum",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"id": 4
}
DELETE /publications/:id - FORMATO DA REQUISIÇÃO
{
"userId": 5,
"icon": "",
"username": "",
"photo": "",
"category": "Lorem ipsum",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"id": "4"
}
Após a deleção esperamos a seguinte resposta:
DELETE /publications/:id - FORMATO DA RESPOSTA - 200 OK
{}