PaymentSerializer

class apirest.payment_serializers.PaymentSerializer(instance=None, data=<class rest_framework.fields.empty>, **kwargs)

Create:

CURL Usage:

curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"amount": 1, "user": "/rest-api/users/1/", "description": "payment_description"}' http://HOSTNAME_IP/rest-api/payment/

Response:

HTTP/1.0 201 Created
Vary: Accept, Accept-Language, Cookie
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Content-Language: en
Allow: GET, POST, OPTIONS
Connection: close
Server: Werkzeug/0.11.11 Python/2.7.9
Date: Fri, 23 Dec 2016 11:43:00 GMT

{"amount":"1.00000", "user":"http://127.0.0.1:8000/rest-api/users/1/", "description":"payment_description", "created_date":"2016-12-23T11:43:00.242808Z"}

Read:

CURL Usage:

curl -u username:password -H 'Accept: application/json' http://HOSTNAME_IP/rest-api/payment/

Response:

{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "amount": "2.00000",
      "user": "http://127.0.0.1:8000/rest-api/users/1/",
      "description": "Wire payment",
      "created_date": "2016-04-07T16:05:16.210592Z"
    },
    {
      "amount": "0.50000",
      "user": "http://127.0.0.1:8000/rest-api/users/2/",
      "description": "Manual Payment",
      "created_date": "2016-04-07T16:05:34.803729Z"
    }
  ]
}