Update a Powerpack

    Change a Powerpack’s name, sticky_sender, local_connect, or the application connected to it.

    API Endpoint

    POST https://api.plivo.com/v1/Account/{auth_id}/Powerpack/{powerpack_uuid}/

    Arguments

    namestringMust be unique across all Powerpacks in customer’s account.
    sticky_senderBoolean

    Whether Sticky Sender should be enabled by default. Sticky Sender ensures messages to a particular destination number are always sent from the same source number.

    Defaults to true.

    local_connectBoolean

    Whether Local Connect should be enabled by default. Local Connect prioritizes local numbers matched on area code and state over other numbers in the pool.

    Defaults to true.

    application_typeBoolean

    Conditional Must be specified if application_id is specified and is not "none".

    Allowed values: xml, phlo

    application_idString

    Must be set to a valid PHLO or XML App ID or "none" (String). If not specified (or set to "none") no application to be associated with phone numbers added to this Powerpack.

    Response

    HTTP Status Code: 200

    {
       "api_id":"8b583f08-ae57-11eb-8840-0242ac110003",
       "application_id":"",
       "application_type":"",
       "created_on":"2020-09-23T09:31:25.924044Z",
       "local_connect":true,
       "name":"<powerpack_name>",
       "number_pool":"/v1/Account/<power_uuid>/NumberPool/<numberpool_id>/",
       "number_priority":[
          {
             "country_iso":"US",
             "priority":{
                "priority1":"shortcode",
                "priority2":"tollfree",
                "priority3":"longcode"
             },
             "service_type":"MMS"
          },
          {
             "country_iso":"CA",
             "priority":{
                "priority1":"shortcode",
                "priority2":"tollfree",
                "priority3":"longcode"
             },
             "service_type":"SMS"
          },
          {
             "country_iso":"US",
             "priority":{
                "priority1":"shortcode",
                "priority2":"longcode",
                "priority3":"tollfree"
             },
             "service_type":"SMS"
          },
          {
             "country_iso":"CA",
             "priority":{
                "priority1":"longcode",
                "priority2":"tollfree",
                "priority3":"shortcode"
             },
             "service_type":"MMS"
          }
       ],
       "sticky_sender":true,
       "uuid":"<powerpack_uuid>"
    }
    

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    import plivo
    import json
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    params = {}
    number_priorities = [
        {'country_iso': 'US',
        'priority': {'priority1': 'longcode', 'priority2': 'tollfree', 'priority3': 'shortcode'},
        'service_type': 'SMS'
        }]
    params["name"] = "<update_powerpack_name>"
    params["number_priority"] = number_priorities
    
    response = powerpack.update(params)
    print(response)
    
    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
    
    require 'rubygems'
    require 'plivo'
    require 'json'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    
    begin
    	powerpack = api.powerpacks.get("<Powerpack_Name>")
    
    	# Define Priority
    	number_priority_json = Array[{"country_iso"=>"US",
        "priority"=>{"priority1"=>"tollfree","priority2"=>"longcode","priority3"=>"shortcode"}, 
        "service_type"=>"SMS"}]
    
    	# Update Powerpack
    	response = powerpack.update(name: '<update_powerpack_name>', 
    		sticky_sender: true, 
    		local_connect: false,
    	number_priority: number_priority_json)
    
    	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
    18
    19
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    
    // Update Powerpack
    var params = {
        number_priority: [{
            service_type: "MMS",
            country_iso: "CA",
            priority: {
                priority1: "tollfree",
                priority2: "shortcode",
                priority3: "longcode"
            }
        }]
    };
    client.powerpacks.update("<powerpack_uuid>", params).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
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    
    $client->client->setTimeout(120);
    $optionalArgs = array(
        "limit" => 2,
        "offset" => 0
    );
    
    //  Create Priority Json
    $priority = array(
        "priority1" => "tollfree",
        "priority2" => "longcode",
        "priority3" => "shortcode"
    );
    
    //  Create Number Priority Json
    $number_priority = array(
        "country_iso" => "US",
        "priority" => $priority,
        "service_type" => "SMS"
    );
    
    // Update a Powerpack - Flexible Priority
    try
    {
        $powerpack = $client->powerpacks->get("<powerpack_uuid>");
        $response = $powerpack->update(["name" => "<powerpack_name>", "number_priority" => array($number_priority)]);
        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 com.plivo.api.models.powerpack.Powerpack;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.powerpack.PowerpackUpdateResponse;
    import java.io.IOException;
    
    public class PowerpackTest {
        public static void main(String[] args) {
            Plivo.init("<auth_id>", "<auth_token>");
            // Update Powerpack
            try {
                Powerpack powerpack = Powerpack.getter("powerpack_uuid").get();
                NumberPriority[] numberPriorities = new NumberPriority[1];
                // Priority(""priority1"",""priority2"", ""priority3"")
                Priority priority = new Priority("shortcode", "tollfree", "longcode");
                // NumberPriority(""country_iso"", ""priority"", ""service_type"")
                NumberPriority numberPriority = new NumberPriority("CA", priority, "MMS");
                numberPriorities[0] = numberPriority;
                PowerpackUpdateResponse response = powerpack.updater().number_priority(numberPriorities).update();
                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
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    using Plivo.Resource.Powerpack;
    // using Plivo.Resource.Powerpack.NumberPriority;
    
    namespace dotnet_project
    {
        class Sms
        {
            public static void Main(string[] args)
            {
    
                var api = new PlivoApi("<auth_id>","<auth_token>");
    
                // Define Priority
                Priority p1 = new Priority();
                p1.priority1 = "longcode";
                p1.priority2 = "shortcode";
                p1.priority3 = "tollfree";
    
                // Set Number Priority based on service_type & country
                NumberPriority numberPriority = new NumberPriority();
                numberPriority.service_type = "SMS";
                numberPriority.country_iso = "US";
                numberPriority.priority = p1;
    
                List<NumberPriority> list = new List<NumberPriority>(){numberPriority};  
    
                // Update a Powerpack
                Console.WriteLine("Update a Powerpack");
                try
                {
                    var response = api.Powerpacks.Update(uuid: "<powerpack_uuid>",
                                                            name: "<powerpack_name>", 
                                                            sticky_sender: true,
                                                            local_connect: true,
                                                            number_priority: list);
                    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
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    
    curl --location --request POST 'https://api.plivo.com/v1/Account/<auth_id>/Powerpack/' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic xxxxxxxxxxxxx' \
    --data-raw '{
            "name": "<new powerpack name>",
            "sticky_sender": false,
        "number_priority": [
            {
                "country_iso": "US",
                "priority": {
                    "priority1": "longcode",
                    "priority2": "shortcode",
                    "priority3": "tollfree"
                },
                "service_type": "MMS"
            },
            {
                "country_iso": "CA",
                "priority": {
                    "priority1": "longcode",
                    "priority2": "shortcode",
                    "priority3": "tollfree"
                },
                "service_type": "SMS"
            },
            {
                "country_iso": "US",
                "priority": {
                    "priority1": "longcode",
                    "priority2": "shortcode",
                    "priority3": "tollfree"
                },
                "service_type": "SMS"
            },
            {
                "country_iso": "CA",
                "priority": {
                    "priority1": "longcode",
                    "priority2": "shortcode",
                    "priority3": "tollfree"
                },
                "service_type": "MMS"
            }
        ],
        "local_connect": true
    }
    
    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
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    
    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)
        }
    
        // Define Priority
        priority: = plivo.Priority {
            Priority1: strPtr("shortcode"),
            Priority2: strPtr("tollfree"),
            Priority3: strPtr("longcode")
        }
    
        np_json: = plivo.NumberPriority {
            "SMS", "CA", priority
        }
        priority_array: = [] plivo.NumberPriority {
            np_json
        }
    
        // Create a Powerpack
        response, err: = client.Powerpack.Create(plivo.PowerackCreateParams {
            Name: "<new_powerpack_name>",
            StickySender: "false",
            LocalConnect: "true",
            NumberPriorities: priority_array,
        }, )
        if err != nil {
            panic(err)
        }
        fmt.Printf("Response: %#v\n", response)
    
    }
    
    func strPtr(s string) * string {
        return &s
    }