PhonebookSerializer

class apirest.phonebook_serializers.PhonebookSerializer(instance=None, data=None, files=None, context=None, partial=False, many=False, allow_add_remove=False, **kwargs)

Create:

CURL Usage:

curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"name": "myphonebook"}' http://localhost:8000/rest-api/phonebook/

Response:

HTTP/1.0 201 CREATED
Date: Fri, 14 Jun 2013 09:52:27 GMT
Server: WSGIServer/0.1 Python/2.7.3
Vary: Accept, Accept-Language, Cookie
Content-Type: application/json; charset=utf-8
Content-Language: en-us
Allow: GET, POST, HEAD, OPTIONS

Read:

CURL Usage:

curl -u username:password -H 'Accept: application/json' http://localhost:8000/rest-api/phonebook/

curl -u username:password -H 'Accept: application/json' http://localhost:8000/rest-api/phonebook/%phonebook-id%/

Response:

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "url": "http://127.0.0.1:8000/rest-api/phonebook/1/",
            "name": "Default_Phonebook",
            "description": "",
            "user": "http://127.0.0.1:8000/rest-api/users/1/",
            "created_date": "2011-04-08T07:55:05",
            "updated_date": "2011-04-08T07:55:05"
        }
    ]
}

Update:

CURL Usage:

curl -u username:password --dump-header - -H "Content-Type: application/json" -X PATCH --data '{"name": "mylittle phonebook"}' http://localhost:8000/rest-api/phonebook/%phonebook-id%/

Response:

HTTP/1.0 200 NO CONTENT
Date: Fri, 23 Sep 2011 06:46:12 GMT
Server: WSGIServer/0.1 Python/2.7.1+
Vary: Accept-Language, Cookie
Content-Length: 0
Content-Type: text/html; charset=utf-8
Content-Language: en-us

Delete:

CURL Usage:

curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE  http://localhost:8000/rest-api/phonebook/%phonebook-id%/