ContactSerializer

class apirest.contact_serializers.ContactSerializer(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 '{"contact": "12345678", "status": "1", "last_name": "Belaid", "first_name": "Areski", "phonebook": "1"}' http://localhost:8000/rest-api/contact/

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/contact/

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

Response:

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "url": "http://127.0.0.1:8000/rest-api/contact/1/",
            "phonebook": "http://127.0.0.1:8000/rest-api/phonebook/1/",
            "contact": "55555555",
            "status": 1,
            "last_name": "Belaid",
            "first_name": "Arezqui",
            "email": "areski@gmail.com",
            "address": "Address",
            "city": "Barcelona",
            "state": "state",
            "country": "ES",
            "unit_number": "123",
            "additional_vars": "{"facility":"hurron","debt":10,"address":"Sant Lluis street 60"}",
            "description": "test subscriber",
            "created_date": "2013-06-27T19:48:45.118",
            "updated_date": "2013-06-27T19:48:45.118"
        },
    ]
}

Update:

CURL Usage:

curl -u username:password --dump-header - -H "Content-Type: application/json" -X PATCH --data '{"contact": "12345678", "status": "1", "last_name": "Belaid", "first_name": "Areski", "phonebook": "1"}' http://localhost:8000/rest-api/contact/%contact-id%/

Response:

HTTP/1.0 202 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
get_fields(*args, **kwargs)

filter survey field