This API lets you fetch all the campaigns associated with an account.
GET
https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/
limitinteger |
Denotes the number of results per page. The maximum number of results that can be fetched is 20. Defaults to 20. |
offset integer |
Denotes the number of value items by which the results should be offset. Defaults to 0. Read more about offset-based pagination. |
usecasestring |
Filter by use case. Allowed values: 2FA, ACCOUNT_NOTIFICATION, CUSTOMER_CARE, DELIVERY_NOTIFICATION, FRAUD_ALERT, HIGHER_EDUCATION, LOW_VOLUME, MARKETING, MIXED, POLLING_VOTING, PUBLIC_SERVICE_ANNOUNCEMENT, SECURITY_ALERT, STARTER. |
api_id and a dictionary with an objects property that contains up to 20 campaigns. Each tuple in the list is a separate Campaign object.
HTTP Status Code: 200
{
"api_id": "48c97702-3d66-11ed-95d8-0242ac110004",
"campaigns": [{
"brand_id": "BANGTIJ",
"campaign_id": "C6OH4VW",
"help_message": "Using this campaign for real-time data tracking from customer to user and back",
"message_flow": "Using this campaign for real-time data tracking from customer to user and back",
"mno_metadata": {
"AT&T": {
"tpm": 75
},
"T-Mobile": {
"brand_tier": "TOP"
},
"US Cellular": {
"tpm": 75
},
"Verizon Wireless": {
"tpm": 75
}
},
"registration_status": "PROCESSING",
"reseller_id": "",
"sub_usecase": "HIGHER_EDUCATION",
"usecase": "LOW_VOLUME"
},
{
"brand_id": "BCKWPKX",
"campaign_id": "CSE1RH9",
"help_keywords": "SAMPLE1",
"help_message": "Help message is a mandatory parameter, minimum 20 characters",
"message_flow": "Message flow is a mandatory parameter, minimum 40 characters",
"mno_metadata": {
"AT&T": {
"tpm": 240
},
"T-Mobile": {
"brand_tier": "LOW"
},
"US Cellular": {
"tpm": 240
},
"Verizon Wireless": {
"tpm": 240
}
},
"optin_keywords": "YES,SUBSCRIBE",
"optin_message": "Opt-in message should have a minimum of 20 characters",
"optout_keywords": "NO,STOP",
"optout_message": "Opt-out message should have a minimum of 20 characters",
"registration_status": "PROCESSING",
"reseller_id": "",
"sub_usecase": "2FA,MARKETING",
"usecase": "MIXED"
}
],
"meta": {
"limit": 10,
"next": "/v1/Account/MAODZKMDFJMJU3MTEYNG/10dlc/Campaign/?limit=10&offset=10",
"offset": 0
}
}
1
2
3
4
5
6
7
8
9
import sys
sys.path.append("../plivo-python")
import plivo
client = plivo.RestClient("<auth_id>", "<auth_token>")
response = client.campaign.get_number(
campaign_id="<campaign_id>", number="14845197139"
)
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
require "rubygems"
require "/etc/plivo-ruby/lib/plivo.rb"
include Plivo
api = RestClient.new("<auth_id>", "<auth_token>")
begin
response = api.campaign.get("<campaign_id>")
puts response
rescue PlivoRESTError => e
puts 'Exception: ' + e.message
end
1
2
3
4
5
6
7
8
9
10
11
12
let plivo = require('plivo');
let client = new plivo.Client("<auth_id>", "<auth_token>");
client.campaign.list(param = {
limit: 20,
offset: 0
})
.then(function(response) {
console.log(JSON.stringify(response));
}).catch(function(error) {
console.log(error);
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
require '/etc/plivo-php/vendor/autoload.php';
use Plivo\RestClient;
$client = new RestClient("<auth_id>", "<auth_token>");
$client->client->setTimeout(60);
try {
$res = $client->campaign->getNumber("<campaign_id>","14845197716");
print_r( $res);
}
catch (PlivoRestException $ex) {
print_r($ex);
}
?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package com.plivo.examples;
import com.plivo.api.Plivo;
import com.plivo.api.models.base.ListResponse;
import com.plivo.api.models.campaign.Campaign;
public class PlivoTest {
public static void main(String[] args) {
Plivo.init("<auth_id>", "<auth_token>");
// List Campaign
try {
ListResponse < Campaign > response = Campaign.lister().limit(1).offset(0).list();
System.out.println(response);
} catch (Exception e) {
e.printStackTrace();
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;
namespace dotnet_project
{
class Ten_dlc
{
static void Main(string[] args)
{
var api = new PlivoApi("<auth_id>", "<auth_token>");
try
{
var response = api.Campaign.List();
Console.WriteLine(response);
}
catch (PlivoRestException e)
{
Console.WriteLine("Exception: " + e.Message);
}
}
}
}
1
2
curl -i --user auth_id:auth_token \
https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main
import (
"fmt"
"os"
plivo "github.com/plivo/plivo-go/v7"
)
func main() {
client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
if err != nil {
panic(err)
}
//List All Campaigns
response, err := client.Campaign.List(plivo.CampaignListParams{Limit: 2, Offset: 0})
if err != nil {
fmt.Printf("Error occurred while listing campaigns. error:%+v\n", err)
os.Exit(1)
} else {
fmt.Printf("%+v\n", response)
}
}