CampaignSerializer

class apirest.campaign_serializers.CampaignSerializer(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 '{"name": "mycampaign01", "description": "", "callerid": "1239876", "startingdate": "2017-01-01 13:13:33", "expirationdate": "2017-06-14 13:13:33", "frequency": "10", "callmaxduration": "50", "maxretry": "3", "intervalretry": "3000", "calltimeout": "45", "aleg_gateway": "/rest-api/gateway/2/", "sms_gateway": "", "content_type": "/rest-api/content-type/42/", "object_id" : "101", "extra_data": "2000", "voicemail": "True", "amd_behavior": "1", "voicemail_audiofile": "", "dnc": "", "user": "/rest-api/users/95/", "phonebook": ["/rest-api/phonebook/85/"], "daily_start_time": "00:00:00", "daily_stop_time": "23:59:59"}' http://HOSTNAME_IP/rest-api/campaigns/

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

{"id": 1, "campaign_code": "JDQBG", "name": "mycampaign1", "description": "", "callerid": "1239876", "phonebook": ["/rest-api/phonebook/1/", "/rest-api/phonebook/2/"], "startingdate": "2016-01-13T13:13:33", "expirationdate": "2016-01-14T13:13:33", "aleg_gateway": "http://HOSTNAME_IP/rest-api/gateway/1/", "user": "http://<IP-HOST>/rest-api/users/1/", "status": 2, "content_type": "http://<IP-HOST>/rest-api/content-type/49/", "object_id": 1, "extra_data": "2000", "dnc": null, "frequency": 20, "callmaxduration": 50, "maxretry": 3, "intervalretry": 3000, "calltimeout": 45, "daily_start_time": "00:00:00", "daily_stop_time": "23:59:59", "monday": true, "tuesday": true, "wednesday": true, "thursday": true, "friday": true, "saturday": true, "sunday": true, "completion_maxretry": 0, "completion_intervalretry": 900}

Read:

CURL Usage:

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

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

Response:

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 2,
            "campaign_code": "BXTWX",
            "name": "Sample survey campaign",
            "description": "",
            "callerid": "",
            "phonebook": [
                "http://HOSTNAME_IP/rest-api/phonebook/1/"
            ],
            "startingdate": "2011-12-27T14:35:46",
            "expirationdate": "2011-12-28T14:35:46",
            "aleg_gateway": "http://HOSTNAME_IP/rest-api/gateway/1/",
            "user": "http://HOSTNAME_IP/rest-api/users/1/",
            "status": 2,
            "content_type": "http://HOSTNAME_IP/rest-api/content-type/49/",
            "object_id": 1,
            "extra_data": "",
            "dnc": "http://HOSTNAME_IP/rest-api/dnc/1/",
            "voicemail": false,
            "amd_behavior": null,
            "voicemail_audiofile": null,
            "frequency": 10,
            "callmaxduration": 1800,
            "maxretry": 0,
            "intervalretry": 300,
            "calltimeout": 45,
            "daily_start_time": "00:00:00",
            "daily_stop_time": "23:59:59",
            "monday": true,
            "tuesday": true,
            "wednesday": true,
            "thursday": true,
            "friday": true,
            "saturday": true,
            "sunday": true,
            "completion_maxretry": 0,
            "completion_intervalretry": 900
        }
    ]
}

Update:

CURL Usage:

curl -u username:password --dump-header - -H "Content-Type: application/json" -X PATCH --data '{"name": "mylittlecampaign243"}' http://HOSTNAME_IP/rest-api/campaigns/%campaign-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

{"id": 1, "campaign_code": "JDQBG", "name": "mylittlecampaign243", "description": "", "callerid": "1239876", "phonebook": ["http://HOSTNAME_IP/rest-api/phonebook/1/", "http://<IP-HOST>/rest-api/phonebook/2/"], "startingdate": "2016-01-13T13:13:33", "expirationdate": "2016-01-14T13:13:33", "aleg_gateway": "http://<IP-HOST>/rest-api/gateway/1/", "user": "http://<IP-HOST>/rest-api/users/1/", "status": 2, "content_type": "http://<IP-HOST>/rest-api/content-type/67/", "object_id": 1, "extra_data": "2000", "dnc": null, "frequency": 20, "callmaxduration": 50, "maxretry": 3, "intervalretry": 3000, "calltimeout": 45, "daily_start_time": "00:00:00", "daily_stop_time": "23:59:59", "monday": true, "tuesday": true, "wednesday": true, "thursday": true, "friday": true, "saturday": true, "sunday": true, "completion_maxretry": 0, "completion_intervalretry": 900}

CURL Usage (Update Campaign Status==Started):

curl -u username:password --dump-header - -H "Content-Type: application/json" -X PATCH --data '{"status": 1}' http://HOSTNAME_IP/rest-api/campaigns/%campaign-id%/

Delete:

CURL Usage:

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

Response:

{
    "data": "campaign deleted"
}