Latest Legacy

List all shortcodes

This API can be used to fetch a list of short codes from the Number Pool based on number_pool_UUID specified in the resource URI.

API Endpoint

GET https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Shortcode/

Arguments

No arguments need to be passed.

Returns

This API returns the list of short codes from the Number Pool matching the filters specified in the request.

The API response also contains a meta field with the following fields:

  • limit: This the size of the page returned in the response.
  • next: The URL that points to the next page of results.
  • offset: The offset for the page returned in the response.
  • previous: The URL that points to the previous page of results.
  • total_count: The total number of records that match the specified filters.

Response

HTTP Status Code: 200

{
    "api_id": "614b2776-0a88-11ea-b072-0242ac110007",
    "meta": {
        "limit": 20,
        "next": "",
        "offset": 0,
        "previous": "",
        "total_count": 1
    },
    "objects": [
        {
            "added_on": "2019-10-09T11:10:59.741978Z",
            "country_iso2": "US",
            "number_pool_uuid": "{number_pool_uuid}",
            "shortcode": "{your_shortcode}"
        }
    ]
}

Example Request

1
2
3
4
5
6
import plivo
import json

client = plivo.RestClient('<auth_id>','<auth_token>')
powerpack = client.powerpacks.get(uuid="<powerpack_uuid>")
print str(powerpack.list_shortcode())
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  powerpack = api.powerpacks.get(uuid='<powerpack_uuid>')
  puts powerpack
  response = powerpack.list_shortcodes()
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var plivo = require('plivo');
var client = new plivo.Client("<auth_id>","<auth_token>");

client.powerpacks
 .get("<powerpack_uuid>")
 .then(function (powerpack) {
   return powerpack.list_shortcodes({
     limit:'2',
     offset:'1'
   });
 })
 .then(function (result) {
   console.log(result);
 })
 .catch(function (response) {
   console.log(response);
 });
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
require 'vendor/autoload.php';
use Plivo\RestClient;

$client = new RestClient("<auth_id>","<auth_token>");
$client->client->setTimeout(40);
try {
    $powerpack = $client->powerpacks->get("<powerpack_uuid>");
    $response = $powerpack->list_shortcodes();
    print_r($response);
}
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.api;

import com.plivo.api.models.base.ListResponse;
import com.plivo.api.models.powerpack.Powerpack;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.powerpack.Shortcode;

import java.io.IOException;

public class PowerpackTest {
  public static void main(String[] args) {
    Plivo.init("<auth_id>", "<auth_token>");
    try {
      Powerpack powerpack = Powerpack.getter("<powerpack_uuid>").get();
      ListResponse<Shortcode> response= powerpack.list_shortcode().list();
      System.out.println(response);
    }
    catch (  PlivoRestException | IOException 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 Plivo;
using Plivo.Exception;
using System.Collections.Generic;

namespace test_apps
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Powerpacks.Get("<powerpack_uuid>");
                Console.WriteLine(response.List_Shortcode());
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }

        }
    }
}
1
2
3
curl -X GET -i --user auth_id:auth_token \
-H "Content-Type: application/json" \
https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Shortcode
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
package main

import (
	"fmt"

	plivo "github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	powerpack, err := client.Powerpack.Get("<powerpack_uuid>")
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := powerpack.List_shortcodes()
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}