Phonebook API

apirest.phonebook_serializers.PhonebookSerializer

Create:

CURL Usage:

curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"name": "myphonebook", "user": "/rest-api/users/1/"}' http://HOSTNAME_IP/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://HOSTNAME_IP/rest-api/phonebook/

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

Response:

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "url": "http://HOSTNAME_IP/rest-api/phonebook/1/",
            "name": "Default_Phonebook",
            "description": "",
            "user": "http://HOSTNAME_IP/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://HOSTNAME_IP/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://HOSTNAME_IP/rest-api/phonebook/%phonebook-id%/