API de cobranças.
$ python manage.py test -v 2
$ python manage.py runserver 0.0.0.0:9000
Para acessar a adminstração é necessário a criação de um usuário.
$ python manage.py createsuperuser
A api disponibiliza um endpoint:
$ curl -X GET http://localhost:9000/api/v1/charges/
$ curl -d '{"appointment":"e8933a87-be8e-4b5e-b1bf-60c8cc965218", "value":"250.00"}' -H "Content-Type: application/json" -X POST http://localhost:9000/api/v1/charges/
Resultado
{
"id": "66880762-2771-4503-8602-d56d87500948",
"value": "250.00",
"appointment": "e8933a87-be8e-4b5e-b1bf-60c8cc965218"
}
$ curl -d '{"id":"66880762-2771-4503-8602-d56d87500948","value":"350.00","appointment":"e8933a87-be8e-4b5e-b1bf-60c8cc965218"}' -H "Content-Type: application/json" -X PUT http://localhost:9000/api/v1/charges/66880762-2771-4503-8602-d56d87500948/
Resultado
{
"id": "66880762-2771-4503-8602-d56d87500948",
"value": "350.00",
"appointment": "e8933a87-be8e-4b5e-b1bf-60c8cc965218"
}
$ curl -d '{"value":"400.00"}' -H "Content-Type: application/json" -X PATCH http://localhost:9000/api/v1/charges/66880762-2771-4503-8602-d56d87500948/
Resultado
{
"id": "66880762-2771-4503-8602-d56d87500948",
"value": "400.00",
"appointment": "e8933a87-be8e-4b5e-b1bf-60c8cc965218"
}
$ curl -X DELETE http://localhost:9000/api/v1/charges/66880762-2771-4503-8602-d56d87500948/