GET
/sms-campaign/Get all SMS campaigns
You can return a list of your SMS campaigns.
Request
- CURL
- JavaScript
- PHP
- Python
curl -X GET -H "Authorization: Token <your_64_char_api_key>"
-H "Accept: */*; version=2" "https://<your_app_subdomain>.user.com/api/public/sms-campaign/"
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://<your_app_subdomain>.user.com/api/public/sms-campaign/");
xhr.setRequestHeader("authorization", "Token <your_64_char_api_key>");
xhr.send(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/sms-campaign/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"Accept: */*; version=2",
"authorization: Token <your_64_char_api_key>"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import http.client
conn = http.client.HTTPSConnection("<your_app_subdomain>.user.com")
payload = ""
headers = { 'authorization': "Token <your_64_char_api_key>" }
conn.request("GET", "/api/public/sms-campaign/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Response
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 8,
"name": "Sample SMS campaign",
"description": "",
"app": 1,
"phone_number": {
"id": 3,
"app": 1,
"provider": "Phone number provider",
"country": "",
"phone_number": "123123123",
"name": "Custom name of your phone number",
"description": "",
"sms": false,
"voice": false,
"price": "0.00",
"last_used_at": null,
"created_at": "2018-02-19T13:01:41.083625Z",
"updated_at": "2018-02-19T13:01:41.083655Z",
"record_incoming_calls": false
},
"type": 1,
"eta": null,
"status": 1,
"recipients": [
1,
2,
3,
4
],
"recipients_ids": "[4,2]",
"recipients_count": 2,
"started_at": null,
"last_message_sent_at": null,
"finished_at": null,
"author": 1,
"created_at": "2018-02-19T13:01:41.097096Z",
"updated_at": "2018-02-19T13:01:41.097126Z",
"statistics": {
"delivery_percentage": 100,
"scheduled": 0,
"delivered": 2
}
},
{
"id": 7,
"name": "Sample SMS campaign",
"description": "",
"app": 1,
"phone_number": {
"id": 1,
"app": 1,
"provider": "Tm",
"country": "",
"phone_number": "123123123",
"name": "name",
"description": "q",
"sms": false,
"voice": false,
"price": "0.00",
"last_used_at": null,
"created_at": "2018-02-19T10:16:26.860720Z",
"updated_at": "2018-02-19T10:16:26.860747Z",
"record_incoming_calls": false
},
"type": 1,
"eta": null,
"status": 1,
"recipients": [
1,
2,
3,
4
],
"recipients_ids": "[4,2]",
"recipients_count": 2,
"started_at": null,
"last_message_sent_at": null,
"finished_at": null,
"author": 1,
"created_at": "2018-02-19T13:01:17.568394Z",
"updated_at": "2018-02-19T13:01:17.568435Z",
"statistics": {
"delivery_percentage": 100,
"scheduled": 0,
"delivered": 2
}
},
]
}