Creates an Application. Creating an application is usually a first step, after which you attach the application to either a number or an endpoint.
POST
https://api.plivo.com/v1/Account/{auth_id}/Application/
answer_url required string |
The URL fetched when a call executes this application. |
app_name required string |
The name of your application.
|
answer_method string |
The method used to call the answer_url. Defaults to POST. |
hangup_url string |
The URL notified when the call hangs up. Defaults to answer_url. |
hangup_method string |
The method used to call the hangup_url. Defaults to POST. |
fallback_answer_url string |
Invoked by Plivo only if answer_url is unavailable or the XML response is invalid. Should contain an XML response. |
fallback_method string |
The method used to call the fallback_answer_url. Defaults to POST. |
message_url string |
The URL notified when an inbound message is received. Defaults not set. |
message_method string |
The method used to call the message_url. Defaults to POST. |
default_number_app boolean |
If set to true, this parameter ensures that newly created numbers that don't have an app_id point to this application. |
default_endpoint_app boolean |
If set to true, this parameter ensures that newly created endpoints that don't have an app_id point to this application. |
subaccount string |
ID of the subaccount that this application is associated with. |
log_incoming_messages boolean |
If set to false, the content of incoming messages to Plivo phone numbers associated with this application are not logged in Plivo systems, including the debug logs available on the Plivo console. Additionally, the last three digits of the "from" number are redacted in all system logs and in the Message Detail Record (MDR) of the incoming message. Defaults to true when not specified. Note that non-redacted content and "from" number are always passed to the the message_url irrespective of the value set for this flag. |
HTTP Status Code: 201
{
"message": "created",
"app_id": "15784735442685051",
"api_id": "5a9fcb68-582d-11e1-86da-6ff39efcb949"
}
1
2
3
4
5
6
7
import plivo
client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.applications.create(
app_name='Test Application',
answer_url='https://answer.url', )
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Example for Application Create
#
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions
api = RestClient.new("<auth_id>","<auth_token>")
begin
response = api.applications.create(
'Test Application',
answer_url: 'https://answer.url',
answer_method: 'GET'
)
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 create
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.create(
"Test Application", // app name
{
answerUrl: "https://answer.url", // 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
22
<?php
/**
* Example for Application create
*/
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
$response = $client->applications->create(
'Test Application',
[
'answer_url' => 'https://answer.url',
'answer_method' => 'POST'
]
);
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
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.ApplicationCreateResponse;
/**
* Example for Application create
*/
class ApplicationCreate {
public static void main(String [] args) {
Plivo.init("<auth_id>","<auth_token>");
try {
ApplicationCreateResponse response = Application.creator("Test Application", "https://answer.url")
.create();
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 Create
*/
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.Create(
appName:"Test Application",
answerUrl:"https://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", "app_name": "Testing_App"}' \
https://api.plivo.com/v1/Account/{auth_id}}/Application/
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 create
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.Create(
plivo.ApplicationCreateParams{
AppName: "Test Application",
AnswerURL: "https://answer.url",
},
)
if err != nil {
fmt.Print("Error", err.Error())
return
}
fmt.Printf("Response: %#v\n", response)
}