-
Endpoint:
/api/v1/login
-
Method:
POST
-
Description: Efetuar login de um usuário.
-
Request Body:
{ "email": "[email protected]", "password": "password" }
-
Response
- Status:
200 OK
- Content:
{ "message": "Authorized", "status": 200, "data": { "token": "dklfjakjdajfkdj@*kdfalkdjfka" //exemplo de token } }
- Status:
-
Response Error
- Status:
403 FORBIDDEN
- Content:
{ "message": "Not Authorized", "status": 403, "data": [] }
- Status:
- Endpoint:
/api/v1/logout
- Method:
POST
- Description: Efetuar o logout de um usuário.
- Response
- Status:
200 OK
- Content:
{ "message": "Token Revoked", "status": 200, "data": [] }
- Status:
- Endpoint:
/api/v1/users
- Method:
GET
- Description: Lista de todos os usuários.
- Response
- Status:
200 OK
- Content:
{ "data": [ { "first_name": "Example", "last_name": "One", "full_name": "Example One", "email": "[email protected]" }, { "first_name": "Example", "last_name": "Two", "full_name": "Example Two", "email": "[email protected]" }, { "first_name": "Example", "last_name": "Three", "full_name": "Example Three", "email": "[email protected]" }, ] }
- Status:
- Endpoint:
/api/v1/users/{user_id}
- Method:
GET
- Description: Pegar um usuário específico.
- Request Body
user_id => integer
- Response
- Status:
200 OK
- Content:
{ "data": { "first_name": "Example", "last_name": "Two", "full_name": "Example Two", "email": "[email protected]" } }
- Status:
- Endpoint:
/api/v1/invoices
- Method:
GET
- Description: Retorna uma lista de todas as faturas.
- Params:
- Content:
'gt' // greater than 'gte', // greter than equal 'lt', // less than 'lte', // less than equal 'eq', // equal 'ne', // not equal 'in', // in
- Content:
- Example:
- Endpoint:
api/v1/invoices?paid[eq]=1
/** pagamento igual a 1 (todas as faturas pagas) **/ - Content: /** Repare que todo 'paid' está como 'Pago' **/
{ "data": [ { "user": { "firstName": "Kraig", "lastName": "Predovic", "fullName": "Kraig Predovic", "email": "[email protected]" }, "type": "Boleto", "value": "R$ 9,918.00", "paid": "Pago", "paymentDate": "30\/11\/2023 08:59:47", "paymentSince": "há 2 semanas" }, { "user": { "firstName": "Kraig", "lastName": "Predovic", "fullName": "Kraig Predovic", "email": "[email protected]" }, "type": "Cartão", "value": "R$ 3,128.00", "paid": "Pago", "paymentDate": "15\/11\/2023 23:22:48", "paymentSince": "há 4 semanas" }, ] }
- Endpoint:
- Response:
- Status:
200 OK
- Content:
{ "data": [ { "user": { "firstName": "Example", "lastName": "One", "fullName": "Example One", "email": "[email protected]" }, "type": "Pix", "value": "R$ 12,000.00", "paid": "Não Pago", "paymentDate": null, "paymentSince": null }, { "user": { "firstName": "Example", "lastName": "Two", "fullName": "Example Two", "email": "[email protected]" }, "type": "Boleto", "value": "R$ 9,918.00", "paid": "Pago", "paymentDate": "30/11/2023 08:59:47", "paymentSince": "há 2 semanas" }, { "user": { "firstName": "Example", "lastName": "Three", "fullName": "Example Three", "email": "[email protected]" }, "type": "Cartão", "value": "R$ 9,918.00", "paid": "Pago", "paymentDate": "30/11/2023 08:59:47", "paymentSince": "há 2 semanas" }, ] }
- Status:
-
Endpoint:
/api/v1/invoices
-
Method:
POST
-
Description: Cria uma nova fatura.
-
Request Body:
{ "user_id": 1, "type": "P", //P: pix, B: boleto, C: cartão "paid": 1, // 0 para 'não pago' e 1 para 'pago' "value": 9000.00 }
-
Response:
- Status:
200 OK
- Content:
{ "message": "Invoice created", "status": 200, "data": { { "user": { "firstName": "Example", "lastName": "One", "fullName": "Example One", "email": "[email protected]" }, "type": "Pix", "value": "R$ 12,000.00", "paid": "Não Pago", "paymentDate": null, "paymentSince": null } } }
- Status:
-
Response Error:
- Status:
400 BAD REQUEST
- Content:
{ "message": "Invoice not created", "status": 400, "data": [] }
- Status:
- Endpoint:
/api/v1/invoices/{invoice_id}
- Method:
GET
- Description: Pegar uma fatura específica.
- Params:
invoice_id => integer
- Response:
- Status:
200 OK
- Content:
{ "data": { "user": { "firstName": "Delta", "lastName": "Heaney", "fullName": "Delta Heaney", "email": "[email protected]" }, "type": "Pix", "value": "R$ 12,000.00", "paid": "Não Pago", "paymentDate": null, "paymentSince": null } }
- Status:
-
Endpoint:
/api/v1/invoices/{invoice_id}
-
Method:
PUT/PATCH
-
Description: Atuaizar uma fatura específica.
-
Request Body:
{ "user_id": 1, "type": "P", //P: pix, B: boleto, C: cartão "paid": 1, // 0 para 'não pago' e 1 para 'pago' "value": 9000.00 }
-
Response:
- Status:
200 OK
- Content:
{ "message": "Invoice updated", "status": 200, "data": { { "user": { "firstName": "Example", "lastName": "One", "fullName": "Example One", "email": "[email protected]" }, "type": "Pix", "value": "R$ 12,000.00", "paid": "Não Pago", "paymentDate": null, "paymentSince": null } } }
- Status:
-
Response Error:
- Status:
400 BAD REQUEST
- Content:
{ "message": "Invoice not updated", "status": 400, "data": [] }
- Status:
- Endpoint:
/api/v1/invoices/{invoice_id}
- Method:
DELETE
- Description: Deletar uma fatura específica.
- Params:
invoice_id => integer
- Response:
- Status:
200 OK
- Content:
{ "message": "Invoice deleted", "status": 200, "data": [] }
- Status:
- Response Error:
- Status:
400 BAD REQUEST
- Content:
{ "message": "Invoice not deleted", "status": 400, "data": [] }
- Status:
- Um agradecimento publicamente.
- Para suporte, mande um email para [email protected].
- Meu linkedin