This API allows to update following parameters in an existing active allocation:
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.
Pricing: The Update API will be charged equivalent to that of a new allocation, as per the price plan. At the time of deallocation, the duration will be computed from the time of original allocation and charged as per the price plan. Deallocation policy can not be overruled with the update API.
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:
{ "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" } }