Latest Legacy

Retrieve all numbers linked to a campaign

This API lets you fetch all the numbers linked to a particular campaign.

API Endpoint

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

Arguments

No arguments need to be passed.

Returns

The number object for that campaign. The status in the phone_numbers tuple indicates the status of the linking request. The phone_numbers tuple contains a status that can take the values

FAILED,

PROCESSING, or

COMPLETED.

Response

HTTP Status Code: 200

{
    "api_id": "8010803c-b4a1-11ec-8f25-0242ac110002",
    "campaign_alias": "ABC Campaign",
    "campaign_id": "CUOGHIN",
    "phone_numbers": [
        {
            "number": "12125557777",
            "status": "PROCESSING"
        },
        {
            "number": "12125557778",
            "status": "PROCESSING"
        },
        {
            "number": "12125557779",
            "status": "FAILED"
        }
    ],
    "usecase": "STARTER"
}

Example Request

1
2
3
4
5
6
7
import sys  
sys.path.append("../plivo-python")  
import plivo 

client = plivo.RestClient("<auth_id>", "<auth_token>")
response = client.campaign.get_numbers(campaign_id="<campaign_id>", limit=20, offset=0)
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_numbers("<Campaign_ID>",limit:2, offset:0)

	puts response
rescue PlivoRESTError => e
	puts 'Exception: ' + e.message
end
1
2
3
4
5
6
7
8
9
10
11
let plivo = require('plivo');

let client = new plivo.Client('<auth_id>', '<auth_token>');

client.campaign.listNumber("<campaign_id>", {})
    .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
23
24
<?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
        ->listNumber("<campaign_id>");
    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
21
22
package com.plivo.examples;

import com.plivo.api.Plivo;
import com.plivo.api.models.campaign.CampaignNumbers;

public class PlivoTest {

    public static void main(String[] args) {

        Plivo.init("<auth_id>", "<auth_token>");

        // List all Campaign Numbers
        try {
            CampaignNumbers response = CampaignNumbers.getNumbers("<Camapign_ID>")
                .limit(2).offset(0).get();
            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
29
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>");

              // Get all Campaign Numbers
            Console.WriteLine("Get all Campaign Numbers");
            try
            {   
                    var response = api.Campaign.ListNumber("<campaign_id>");
                    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/{campaign_id}/Number/?limit=10&offset=0
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"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
	//Get Campaign Numbers
	response, err := client.Campaign.NumbersGet("<Campaign_ID>", plivo.CampaignNumbersGetParams{Limit: 20, Offset: 0})
	if err != nil {
		fmt.Printf("Error occurred while getting numbers. error:%+v\n", err)
		os.Exit(1)
	} else {
		fmt.Printf("%+v\n", response)
	}
}