SubscriberList API¶
-
SubscriberListSerializer
¶ Create:
CURL Usage:
curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"contact": "/rest-api/contact/2/", "campaign": "/rest-api/campaigns/170/", "status": 1, "full_name": "Joe", "additional_vars": "{"transfer_number": "0000001"}"}' http://HOSTNAME_IP/rest-api/subscriber-list/
You can also create a subscriber without contact, just remove the contact field in the curl command above.
Example:
curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"campaign": "/rest-api/campaigns/236/", "status": 1, "duplicate_contact": "+1750784300", "full_name": "Joe", "additional_vars": "{"transfer_number": "0000001"}"}' http://127.0.0.1:8000/rest-api/subscriber-list/
Response:
HTTP/1.0 201 Created Content-Language: en Vary: Accept, Accept-Language, Cookie Location: http://127.0.0.1:8000/rest-api/subscriber-list/2978082/ Allow: GET, POST, HEAD, OPTIONS X-Frame-Options: SAMEORIGIN Content-Type: application/json Connection: close Server: Werkzeug/0.12.2 Python/2.7.9 Date: Thu, 09 Nov 2017 12:29:30 GMT { "url": "http:\/\/127.0.0.1:8000\/rest-api\/subscriber-list\/2978082\/", "contact": "http:\/\/127.0.0.1:8000\/rest-api\/contact\/4\/", "campaign": "http:\/\/127.0.0.1:8000\/rest-api\/campaigns\/170\/", "last_attempt": null, "count_attempt": 0, "status": 1, "duplicate_contact": "+34650784355", "full_name": "Areski Belaid", "gmt_offset": "0.00", "tz_code": "WET", "additional_vars": { "transfer_number": "0000001" } }
Read:
CURL Usage:
curl -u username:password -H 'Accept: application/json' http://HOSTNAME_IP/rest-api/subscriber-list/
Response:
[ { "id": 1, "contact": "/rest-api/contact/11/", "campaign": "/rest-api/campaigns/3/", "last_attempt": null, "count_attempt": 0, "duplicate_contact": "34235464", "status": 1 }, { "id": 2, "contact": "/rest-api/contact/12/", "campaign": "/rest-api/campaigns/3/", "last_attempt": null, "count_attempt": 0, "duplicate_contact": "34235464", "status": 1 } ]
Update:
CURL Usage:
curl -u username:password --dump-header - -H "Content-Type: application/json" -X PATCH --data '{"status": "1"}' http://HOSTNAME_IP/rest-api/subscriber-list/%subscriber_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 {"url":"http://127.0.0.1:8000/rest-api/subscriber-list/429940/","contact":"http://127.0.0.1:8000/rest-api/contact/8392970/","campaign":"http://127.0.0.1:8000/rest-api/campaigns/197/","last_attempt":null,"count_attempt":2,"status":2,"duplicate_contact":"+13022700851","full_name":"TOSHIA","gmt_offset":"-4.00","tz_code":"EDT","additional_vars":{"reference_number":"156564","address":"Test"}}
Delete:
CURL Usage:
curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE http://HOSTNAME_IP/rest-api/subscriber-list/%subscriber_id%/
Response:
{ "data": "subscriber deleted" }