Latest Legacy

Update an endpoint

Updates an endpoint’s password or alias, or the application attached to it.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Endpoint/{endpoint_id}/

Arguments

password string

Password for your endpoint username. It should be at least five characters long.

alias string

Alias for the endpoint.
Allowed Values:

  • Alphabets (upper case and lower case)
  • Numbers (0-9).
  • Only 2 special characters, i.e. "-" (hyphen) and "_" (underscore)
  • app_id string

    ID of the application attached to the endpoint.

    Returns

    Returns a confirmation that the object is updated.

    Response

    HTTP Status Code: 202

    {
      "message": "changed",
      "api_id": "d8f9ea6c-58cc-11e1-86da-adf28403fe48"
    }
    

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import plivo
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    response = client.endpoints.update(
        endpoint_id='14659095951490',
        alias='Double time.', )
    print(response)
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    #
    # Example for Endpoint Update
    #
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    
    begin
      response = api.endpoints.update(
        '39452475478853',
        alias: 'Updated Endpoint 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 Endpoint update
    
    var plivo = require('plivo');
    
    (function main() {
        'use strict';
        
       // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
        var client = new plivo.Client("<auth_id>","<auth_token>");
        client.endpoints.update(
            "39452475478853", // endpoint id
            {
                alias: "Updated Endpoint 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 Endpoint update
     */
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    use Plivo\Exceptions\PlivoRestException;
    $client = new RestClient("<auth_id>","<auth_token>");
    
    try {
        $response = $client->endpoints->update(
            '39452475478853',
            ['alias' => 'Updated Endpoint 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.endpoint;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.endpoint.Endpoint;
    import com.plivo.api.models.endpoint.EndpointUpdateResponse;
    
    /**
    * Example for Endpoint update
    */
    class EndpointUpdate {
        public static void main(String [] args) {
            Plivo.init("<auth_id>","<auth_token>");
            try {
                EndpointUpdateResponse response = Endpoint.updater("39452475478853")
                    .alias("Updated Endpoint 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 Endpoint 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("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Endpoint.Update(
                        endpointId:"39452475478853",
                        alias:"Updated Endpoint Alias"
                    );
                    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": "New_test"}' \
        https://api.plivo.com/v1/Account/{auth_id}/Endpoint/{endpoint_id}/
    
    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
    
    // Example for Endpoint update
    package main
    
    import (
    	"fmt"
    
    	"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
    	}
    	response, err := client.Endpoints.Update(
    		"39452475478853",
    		plivo.EndpointUpdateParams{
    			Alias: "Updated Endpoint Alias",
    		},
    	)
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }