SMS Campaign API

apirest.sms_campaign_serializers.SMSCampaignSerializer

Create:

CURL Usage:

curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"name": "sms", "description": "", "callerid": "1239876", "startingdate": "2016-01-13 13:13:33", "expirationdate": "2016-01-14 13:13:33", "frequency": "20", "maxretry": "3", "sms_gateway": "/rest-api/sms-gateway/1/", "phonebook": ["/rest-api/phonebook/1/"], "daily_start_time": "00:00:00", "daily_stop_time": "23:59:59", "text_message": "Hello world!", "user": "/rest-api/users/1/"}' http://HOSTNAME_IP/rest-api/sms-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, "sms_campaign_code": "JDQBG", "name": "mysmscampaign1", "description": "", "callerid": "1239876", "phonebook": ["/rest-api/phonebook/1/", "/rest-api/phonebook/2/"], "startingdate": "2016-01-13T13:13:33", "expirationdate": "2016-01-14T13:13:33", "sms_gateway": "http://HOSTNAME_IP/rest-api/sms-gateway/1/", "user": "http://<IP-HOST>/rest-api/users/1/", "status": 2, "frequency": 20, "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}

Read:

CURL Usage:

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

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

Response:

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 2,
            "sms_campaign_code": "BXTWX",
            "name": "Sample SMS campaign",
            "description": "",
            "callerid": "",
            "phonebook": [
                "http://HOSTNAME_IP/rest-api/phonebook/1/"
            ],
            "startingdate": "2011-12-27T14:35:46",
            "expirationdate": "2011-12-28T14:35:46",
            "sms_gateway": "http://HOSTNAME_IP/rest-api/sms-gateway/1/",
            "user": "http://HOSTNAME_IP/rest-api/users/1/",
            "status": 2,
            "frequency": 10,
            "callmaxduration": 1800,
            "maxretry": 0,
            "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,
        }
    ]
}

Update:

CURL Usage:

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

Delete:

CURL Usage:

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

Response:

{
    "data": "sms campaign deleted"
}