Update an endpoint

    Updates an endpoint’s password, 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 5 characters long.

    alias string

    Alias for the endpoint.

    app_id string

    app_id of the application that will be attached to this 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()
    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("YOUR_AUTH_ID", "YOUR_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';
        
        // 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.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("YOUR_AUTH_ID", "YOUR_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();
            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("YOUR_AUTH_ID", "YOUR_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
    
    // Example for Endpoint 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.Endpoints.Update(
    		"39452475478853",
    		plivo.EndpointUpdateParams{
    			Alias: "Updated Endpoint Alias",
    		},
    	)
    	if err != nil {
    		panic(err)
    	}
    	fmt.Printf("Response: %#v\n", response)
    }