×

This API allows to update following parameters in an existing active allocation:

  • A-party numbers
  • B-party numbers
  • A-party pins
  • B-party pins
  • Usage (can be changed from 'oneway' to 'twoway' and vice versa)

Other parameters will be inherited from the original allocation.

In the Update API request body, make sure that at least one of the A-party number or B-party number, is present.

A-party pin, B-party pin and usage are optional parameters and should be passed if intended to update.

PUT

https://leadassist.exotel.in/v1/tenants/<your_sid>/greenvn/<greenvn_id>/call-party

Replace <your_sid> with your tenant ID.

Please refer 'Create a VN Allocation' (POST) API for details on request parameters.

curl --location --request PUT 'https://<your_api_key>:<your_api_token>@leadassist.exotel.in/v1/tenants/<account_sid>/greenvn/<greenvn_id>/call-party' \
--header 'Content-Type: application/json' \
--data-raw '{
    "aparty_numbers": [
        "+91995xxxx640", "+9199xxxx5641"
    ],
    
    "bparty_numbers": [
        "+91798xxxx840", "+91798xxxx841"
    ],
    "aparty_pins": [
        12340
    ],
    "bparty_pins": [
        2340
    ],
    "usage": "oneway|twoway"
}'
var request = require("request");
var accountSid = "XXXXXXXXX";
var accountToken = "YYYYYYYYY";
var authKey = "ZZZZZZZZZZ";

var encoding = Buffer.from(authKey + ':' + accountToken).toString('base64')

var options = { 
  	method: 'PUT',
    'url': 'https://leadassist.exotel.in/v1/tenants/'+accountSid+'/greenvn/<greenvn_id>/call-party',
    'headers': {
        'Authorization': 'Basic'+ encoding,
        'Content-Type': 'application/json'
    },
  body: JSON.stringify({"aparty_numbers":["+91995XXXXX40","+9199XXXXXX41"],"bparty_numbers":["+91798XXXXX40","+9179XXXX6841"],"aparty_pins":[12340],"bparty_pins":[2340],"usage":"oneway|twoway"})

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
<?php
$curl = curl_init();
$accountSid = "XXXXXXXXXX";
$accountToken = "YYYYYYYYYY";
$authKey = "ZZZZZZZZZZ";

$encoding = base64_encode($authKey .":". $accountToken);
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://leadassist.exotel.in/v1/tenants/'+$accountSid+'/greenvn/<greenvn_id>/call-party',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_POSTFIELDS =>'{
    "aparty_numbers": [
        "+91995XXXXX40", "+9199XXXXXX41"
    ],
    "bparty_numbers": [
        "+91798XXXXX40", "+9179XXXX6841"
    ],
    "aparty_pins": [
        12340
    ],
    "bparty_pins": [
        2340
    ],
    "usage": "oneway|twoway"
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic '+ $encoding,
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import requests, base64, json

accountSid = "XXXXXXXXX"
authToken = "YYYYYYYYY"
authKey = "ZZZZZZZZZZ"

encoding = base64.b64encode(authKey + ":" + authToken)

url = "https://leadassist.exotel.in/v1/tenants/"+ accountSid+"/greenvn/<greenvn_id>/call-party"

payload = json.dumps({
    "aparty_numbers": [
        "+91995XXXXX40", "+9199XXXXXX41"
    ],
    "bparty_numbers": [
        "+91798XXXXX40", "+9179XXXX6841"
    ],
    "aparty_pins": [
        12340
    ],
    "bparty_pins": [
        2340
    ],
    "usage": "oneway|twoway"
})

headers = {
  'Authorization': 'Basic '+ encoding,
  'Content-Type': 'application/json'
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
package main

import (
	b64 "encoding/base64"
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
)

func main() {
	// Please provide accountSid, authToken from your Exotel account
	accountSid := "XXXXXXXXX"
	authToken := "YYYYYYYY"
	authKey := "ZZZZZZZZZZ"

	// Encoding the accountSid and authToken, used in Authorization header
	encoding := b64.StdEncoding.EncodeToString([]byte(authKey + ":" + authToken))
	url := "https://leadassist.exotel.in/v1/tenants/" + accountSid + "/greenvn/<greenvn_id>/call-party"

	payload := strings.NewReader(`{
		"aparty_numbers": [
			"+91995xxxx640", "+9199xxxx5641"
		],
		
		"bparty_numbers": [
			"+91798xxxx840", "+91798xxxx841"
		],
		"aparty_pins": [
			12340
		],
		"bparty_pins": [
			2340
		],
		"usage": "oneway|twoday"
	}`)

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("Authorization", "Basic "+encoding)
	req.Header.Add("cache-control", "no-cache")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

HTTP Response:

  • On success, the HTTP response status code will be 200
  • The connection_id is the unique identifier of the original allocation, and it will be referred in HTTP body will contain a JSON similar to the one below
{
           "success": true,
           "status": 200,
           "data":{
                          "connection_id":"abcd12345",
                          "aparty_numbers":[
                                           "+91995xxxx640", "+9199xxxx5641"
                          ],
                          "bparty_numbers":[
                                           "+91798xxxx840", "+91798xxxx841"
                          ],
                          "aparty_pins": [
                                          12340
                          ],
                          "bparty_pins": [
                                          2340
                          ],
                          "usage":"oneway|twoway",
                          "state": "active",
                          "green_vn":"+918012345678",
                          "greenvn_id":"123456"
           }
}