Retrieve all campaigns

    This API lets you fetch all the campaigns associated with an account.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/

    Arguments

    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.

    Returns

    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.

    Response

    HTTP Status Code: 200

    {
        "api_id": "97f8d684-d122-11ec-8703-0242ac110002",
        "campaigns": [
            {
                "brand_id": "BOFNVUC",
                "campaign_id": "CTUL7XL",
                "mno_metadata": {
                    "AT&T": {
                        "tpm": 4500
                    },
                    "T-Mobile": {
                        "brand_tier": "TOP"
                    },
                    "US Cellular": {
                        "tpm": 4500
                    },
                    "Verizon Wireless": {
                        "tpm": 4500
                    }
                },
                "registration_status": "FAILED",
                "reseller_id": "",
                "usecase": "2FA"
            },
            {
                "brand_id": "BOFNVUC",
                "campaign_id": "CTPGADD",
                "mno_metadata": {
                    "AT&T": {
                        "tpm": 4500
                    },
                    "T-Mobile": {
                        "brand_tier": "TOP"
                    },
                    "US Cellular": {
                        "tpm": 4500
                    },
                    "Verizon Wireless": {
                        "tpm": 4500
                    }
                },
                "registration_status": "PROCESSING",
                "reseller_id": "",
                "usecase": "FRAUD_ALERT"
            },
            {
                "brand_id": "BXGCZWP",
                "campaign_id": "CB7J0NT",
                "mno_metadata": {
                    "AT&T": {
                        "tpm": 4500
                    },
                    "T-Mobile": {
                        "brand_tier": "TOP"
                    },
                    "US Cellular": {
                        "tpm": 4500
                    },
                    "Verizon Wireless": {
                        "tpm": 4500
                    }
                },
                "registration_status": "PROCESSING",
                "reseller_id": "",
                "sub_usecase": "ACCOUNT_NOTIFICATION,DELIVERY_NOTIFICATION,CUSTOMER_CARE",
                "usecase": "MIXED"
            },
            {
                "brand_id": "BXZRASW",
                "campaign_id": "CRIZLAC",
                "mno_metadata": {
                    "AT&T": {
                        "tpm": 2400
                    },
                    "T-Mobile": {
                        "brand_tier": "TOP"
                    },
                    "US Cellular": {
                        "tpm": 2400
                    },
                    "Verizon Wireless": {
                        "tpm": 2400
                    }
                },
                "registration_status": "PROCESSING",
                "reseller_id": "",
                "usecase": "2FA"
            }
        ],
        "meta": {
            "limit": 4,
            "next": "/v1/Account/MAXXXXXXXXXXXXXXXXNG/10dlc/Campaign/?limit=4&offset=54",
            "offset": 50,
            "previous": "/v1/Account/MAXXXXXXXXXXXXXXXXNG/10dlc/Campaign/?limit=4&offset=46"
        }
    }
    

    Example Request

    1
    2
    3
    4
    5
    
    import plivo
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.campaign.list(limit=1, offset=0)
    print(response)
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    	# List Campaign
    	puts('List Campaign')
    	response = api.campaign.list(limit:1, offset:0)
    
    	puts response
    rescue PlivoRESTError => e
    	puts 'Exception: ' + e.message
    end
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    let plivo = require('plivo');
    
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    client.campaign.list()
        .then(function (response) {
            console.log(JSON.stringify(response));
        }).catch(function (error) {
            console.log("err");
            console.log(error);
        });
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    <?php
    
    # Available in versions >= 4.29.0 (https://github.com/plivo/plivo-php/releases/tag/v4.29.0)
    
    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
            ->list();
        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
    26
    27
    28
    
    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>");
    
                // List Campaigns
                Console.WriteLine("List Campaigns");
                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)
    	}
    }