Latest Legacy

Modify an Application

Modify an application using this API.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Application/{app_id}/

Arguments

answer_url

The URL invoked when a call executes this application.

answer_method

The method used to call the answer_url. Defaults to POST.

hangup_url

The URL notified when the call hangs up.

hangup_method

The method used to call the hangup_url. Defaults to POST.

fallback_answer_url

Invoked by Plivo only if answer_url is unavailable or the XML response is invalid. Should contain a XML response.

fallback_method

The method used to call the fallback_answer_url. Defaults to POST.

message_url

The URL that is notified by Plivo when an inbound message is received.

message_method

The method used to call the message_url. Defaults to POST.

default_number_app

If set to true , associates all newly created Plivo numbers that have not specified an app_id to this application.Takes a value of True or False.

default_endpoint_app

If set to true , associates all newly created Plivo endpoints that have not specified an app_id to this application.Takes a values of True or False.

subaccount

ID of the subaccount with which this application is associated.

log_incoming_messages

This flag controls whether incoming messages to phone numbers associated with the Application are logged in Plivo systems or not. When set to false , message content is not logged in any Plivo system, including the debug logs visible on the console. Additionally, the last three digits of the from number are redacted in all system logs and in the Message Detail Record (MDR). The default value of this parameter is true .

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
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.applications.update(
    app_id='21686794894743506',
    answer_url='https://updated.answer.url', )
print(response)

# You can updated an application directly using the application object
application = client.applications.get('21686794894743506')
application.update(
    answer_url='https://updated.answer.url', )
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# Example for Application Update
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

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

begin
  response = api.applications.update(
    '15784735442685051',
    answer_url: 'https://updated.answer.url'
  )
  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 Application 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.applications.update(
        "15784735442685051", // app id
        {
            answerUrl: "https://updated.answer.url",
        },
    ).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
20
21
<?php
/**
 * Example for Application update
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->applications->update(
        '1101234567899201',
        [
        	'answer_url' => 'https://updated.answer.url'
        ]
    );
    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.application;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.application.Application;
import com.plivo.api.models.application.ApplicationUpdateResponse;

/**
* Example for Application update
*/
class ApplicationUpdate {
    public static void main(String [] args) {
        Plivo.init("<auth_id>","<auth_token>");
        try {
            ApplicationUpdateResponse response = Application.updater("15784735442685051")
                .answerUrl("https://updated.answer.url")
                .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 Application 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.Application.Update(
                    appId:"15784735442685051",
                    answerUrl:"https://updated.answer.url"
                );
                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 '{"answer_url": "https://<yourdomain>.com"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Application/{app_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 Application 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.Applications.Update(
		"15784735442685051",
		plivo.ApplicationUpdateParams{
			AnswerURL: "https://updated.answer.url",
		},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}