Contact API

apirest.contact_serializers.ContactSerializer

Create:

CURL Usage:

curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"contact": "+34650787878", "full_name": "Areski Belaid", "phonebook": "/rest-api/phonebook/1/", "additional_vars": "{"transfer_number": "0000001"}"}' http://HOSTNAME_IP/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://HOSTNAME_IP/rest-api/contact/

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

Filter per phonebook:

curl -u username:password -H 'Accept: application/json' http://127.0.0.1/rest-api/contact/?phonebook_id=23

Response:

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "url": "http://HOSTNAME_IP/rest-api/contact/1/",
            "phonebook": "http://HOSTNAME_IP/rest-api/phonebook/1/",
            "contact": "55555555",
            "full_name": "Arezqui Belaid",
            "additional_vars": "{"facility":"hurron","debt":10,"address":"Sant Lluis street 60"}"
        },
    ]
}

Update:

CURL Usage:

curl -u username:password --dump-header - -H "Content-Type: application/json" -X PATCH --data '{"contact": "12345678", "full_name": "Areski Belaid", "phonebook": "1"}' http://HOSTNAME_IP/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

Delete:

CURL Usage:

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