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 optional | The URL invoked by Plivo when a call executes this application. |
answer_method optional Defaults to POST | The method used to call the answer_url. |
hangup_url optional | The URL that is notified by Plivo when the call hangs up. |
hangup_method optional Defaults to POST | The method used to call the hangup_url. |
fallback_answer_url optional | Invoked by Plivo only if answer_url is unavailable or the XML response is invalid. Should contain a XML response. |
fallback_method optional Defaults to POST | The method used to call the fallback_answer_url. |
message_url optional Defaults not set | The URL that is notified by Plivo when an inbound message is received. |
message_method optional Defaults to POST | The method used to call the message_url. |
default_number_app optional | 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 optional | 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 optional | Id of the subaccount, in case only subaccount applications are needed. |
log_incoming_messages optional | 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()
response = client.applications.update(
app_id='21686794894743506',
answer_url='http://updated.answer.url', )
print(response)
# You can updated an application directly using the application object
application = client.applications.get('21686794894743506')
application.update(
answer_url='http://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("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN")
begin
response = api.applications.update(
'15784735442685051',
answer_url: 'http://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';
// 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.applications.update(
"15784735442685051", // app id
{
answerUrl: "http://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("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");
try {
$response = $client->applications->update(
'1101234567899201',
[
'answer_url' => 'http://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();
try {
ApplicationUpdateResponse response = Application.updater("15784735442685051")
.answerUrl("http://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("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");
try
{
var response = api.Application.Update(
appId:"15784735442685051",
answerUrl:"http://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": "http://exampletest.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
// Example for Application 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.Applications.Update(
"15784735442685051",
plivo.ApplicationUpdateParams{
AnswerURL: "http://updated.answer.url",
},
)
if err != nil {
panic(err)
}
fmt.Printf("Response: %#v\n", response)
}