Creates a new endpoint.
POST
https://api.plivo.com/v1/Account/{auth_id}/Endpoint/
username required string |
Username for the endpoint. Only alphanumeric characters are accepted, and the username must start with an alphabetic character. |
password required string |
Password for the endpoint username. It should be at least five characters long. |
alias required string |
Alias for the endpoint.
|
app_id string |
ID of the application attached to the endpoint. |
If successful, returns “created” in the “message” field along with an updated username of the endpoint, which has a 12-digit number appended to the username provided in the request. It also returns endpoint_id, which is a unique ID for the endpoint that’s used with other endpoint APIs.
HTTP Status Code: 201
{
"username": "zumba131031145958",
"alias": "zumba",
"message": "created",
"endpoint_id": "37371860103666",
"api_id": "1c13de4c-423d-11e3-9899-22000abfa5d5"
}
1
2
3
4
5
6
7
8
import plivo
client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.endpoints.create(
username='testusername',
password='testpassword',
alias='Test Account', )
print(response)
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 Create
#
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions
api = RestClient.new("<auth_id>","<auth_token>")
begin
response = api.endpoints.create(
'testusername',
'testpassword',
'Test Account',
'app id'
)
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
// Example for Endpoint 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.endpoints.create(
"testusername", // username
"testpassword", // password
"Test Account", // 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
20
<?php
/**
* Example for Endpoint create
*/
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("<auth_id>","<auth_token>");
try {
$response = $client->endpoints->create(
'testusername',
'testpassword',
'Test Account'
);
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.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.EndpointCreateResponse;
/**
* Example for Endpoint create
*/
class EndpointCreate {
public static void main(String [] args) {
Plivo.init("<auth_id>","<auth_token>");
try {
EndpointCreateResponse response = Endpoint.creator("testusername", "testpassword", "Test Account")
.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
31
/**
* Example for Endpoint 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.Endpoint.Create(
username:"testusername",
alias:"Test Account",
password:"testpassword"
);
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 '{"username": "testuser", "password": "test123", "alias": "Test"}' \
https://api.plivo.com/v1/Account/{auth_id}/Endpoint/
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
// Example for Endpoint 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.Endpoints.Create(
plivo.EndpointCreateParams{
Username: "testusername",
Password: "testpassword",
Alias: "Test Account",
},
)
if err != nil {
fmt.Print("Error", err.Error())
return
}
fmt.Printf("Response: %#v\n", response)
}