Latest Legacy

Remove a Shortcode

Removes the shortcode from the number pool resource. A shortcode can’t be unrented using this. It is only unlinked from the numberpool resource.

API Endpoint

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

Arguments

No arguments need to be passed.

Returns

This API call removes the shortcode from the number pool resource identified by the number & number_pool_uuid specified in the request URL.

Response

HTTP Status Code: 200

{
    "api_id": "c378d44c-0a89-11ea-b072-0242ac110007",
    "response": "success"
}

Example Request

1
2
3
4
5
6
7
8
9
10
11
import plivo

client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")

# Unlink a Shortcode from Powerpack
powerpack = client.powerpacks.get(uuid='<powerpack_uuid>')
# Version 1
response = powerpack.remove_shortcode('<shortcode>')
# Version 2
response = powerpack.numberpool.shortcodes.remove('<shortcode>')
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>", "auth_token")

begin
# Unlink a Shortcode from Powerpack
powerpack = api.powerpacks.get('<powerpack_uuid>')
# Version 1
response = powerpack.remove_shortcode('<shortcode>')
# Version 2
response = powerpack.numberpool.shortcodes.remove('<shortcode>')

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

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

// Unlink a Shortcode from Powerpack
client.powerpacks.get("<powerpack_uuid>").then(
  function (powerpack) {
    return powerpack.remove_shortcode("<shortcode>")
    // return powerpack.number_pool.shortcodes.remove("<shortcode>")  V2
  })
.then(function (result) {
  console.log(result)
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
require 'vendor/autoload.php';
use Plivo\RestClient;

$client = new RestClient("<auth_id>", "<auth_token>");
$client->client->setTimeout(40);

// Unlink a Shortcode from Powerpack
    try {
        $powerpack = $client->powerpacks->get("<powerpack_uuid>");
        // Version 1
        $response = $powerpack->remove_shortcode('<shortcode>');
        // Version 2
        $response = $powerpack->number_pool->shortcodes->remove('shortcode_uuid');
        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
23
24
25
26
package com.plivo.api;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.powerpack.Powerpack;


public class Test {
        
    public static void main(String[] args) {
        
        Plivo.init("<auth_id>", "<auth_token>");

        // Unlink a Shortcode from Powerpack
        try {
            Powerpack powerpack = Powerpack.getter("<powerpack_uuid>").get();
            // Version 1
            powerpack.remove_shortcode().shortcode("<shortcode>").delete();
            // Version 2
            powerpack.numberpool.shortcodes.remove().shortcode("<shortcode>").delete();
        } 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
26
27
28
29
30
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var api = new PlivoApi("<auth_id>","<auth_token>");

            // Unlink a Shortcode from Powerpack
            try
            {
                var powerpack = api.Powerpacks.Get("<powerpack_uuid>");
                // Version 1
                var response = powerpack.Remove_Shortcode("<shortcode>");
                // Version 2
                var response = powerpack.numberpool.shortcodes.Remove("<shortcode>");
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}
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
package main

import (
	"fmt"

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

func main() {

	client, err := plivo.NewClient("<auth_id>", "<auth_token>",
		&plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}

	// Unlink a Shortcode from Powerpack
	powerpack, err := client.Powerpack.Get("<powerpack_uuid>")
	if err != nil {
		panic(err)
	}
	response, err := powerpack.Remove_shortcode("<shortcode>")
	if err != nil {
		panic(err)
	}
	fmt.Printf("Response: %#v\n", response)
}