Update an account phone number
Change the application and sub-account associated to specified phone number from your account.
API Endpoint
POST
https://api.plivo.com/v1/Account/{auth_id}/Number/{number}/
Arguments
app_id string | The application to be assigned to the phone number. If not specified, the application selected as the default_number_app of the Account is assigned. For more information, refer default_number_app argument in application and app_id attribute in application object. |
subaccount string | The auth_id of the subaccount to which this number should be added. This can be performed only by the main account. |
alias string | An alias assigned to the phone number. |
Response
HTTP Status Code: 202
{
"message": "changed",
"api_id": "5a9fcb68-582d-11e1-86da-6ff39efcb949"
}
Example Request
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import plivo
client = plivo.RestClient()
response = client.numbers.update(
number='1314315XXXX',
alias='Updated Alias', )
print(response)
# Or you could use the Number object directly to update the details
client = plivo.RestClient()
number = client.numbers.get(
number='1314315XXXX', )
response = number.update(
alias='Updated Alias', )
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# Example for Number Update
#
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions
api = RestClient.new("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN")
begin
response = api.numbers.update(
'17609915566',
alias: 'Updated Alias'
)
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
20
// Example for Number update
var plivo = require('plivo');
(function main() {
'use strict';
// As the auth_id and auth_token are unspecified, Plivo will fetch them from the PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN environment variables.
var client = new plivo.Client();
client.numbers.update(
"17609915566", // number
{
alias: "Updated Alias",
},
).then(function (response) {
console.log(response);
}, function (err) {
console.error(err);
});
})();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
/**
* Example for Number update
*/
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");
try {
$response = $client->numbers->update(
'17609915566',
['alias' => 'Updated Alias']
);
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
package com.plivo.api.samples.number;
import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.number.Number;
import com.plivo.api.models.number.NumberUpdateResponse;
/**
* Example for Number update
*/
class NumberUpdate {
public static void main(String [] args) {
Plivo.init();
try {
NumberUpdateResponse response = Number.updater("17609915566")
.alias("Updated Alias")
.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
/**
* Example for Number Update
*/
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;
namespace PlivoExamples
{
internal class Program
{
public static void Main(string[] args)
{
var api = new PlivoApi("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");
try
{
var response = api.Number.Update(
alias:"Updated Alias",
number:"17609915566"
);
Console.WriteLine(response);
}
catch (PlivoRestException e)
{
Console.WriteLine("Exception: " + e.Message);
}
}
}
}
1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN
-H "Content-Type: application/json"
-d '{"alias": "testing"}'
https://api.plivo.com/v1/Account/{auth_id}/Number/11111111111/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Example for Number update
package main
import "fmt"
import "github.com/plivo/plivo-go"
func main() {
client, err := plivo.NewClient("", "", &plivo.ClientOptions{})
if err != nil {
panic(err)
}
response, err := client.Numbers.Update(
"17609915566",
plivo.NumberUpdateParams{
Alias: "Updated Alias",
},
)
if err != nil {
panic(err)
}
fmt.Printf("Response: %#v\n", response)
}
Rate this page
🥳 Thank you! It means a lot to us!
×
Help Us Improve
Thank you so much for rating the page, we would like to get your input for further improvements!
Subscribe to Updates
Thank you for your feedback!