First you need to generate API key from your buyer portal and copy the API key.
Sample Code to Download tariff (the tariff download that is output in CSV):
P.S: This is a PHP Curl example to download the rates for a specific seller, if you're using a different programming language e.g NodeJS, Python, Java please refer to your programming language CURL tutorials to use the
Before you start:
You will need to know the i_tariff value for the seller rates you need to download via API, it may be discovered through Market View API call i_tariff parameter of the rates entry, here is an example:
================================
# php marketview_lookup.php
server_output:{
"status": "success",
"rates": [
{
"prefix": "380",
"vendor_name": "testseller",
"connection_name": "testnew_route1",
"i_tariff": "181", // This i_tariff id needs to be passed in the Carrier Rates Download API.
================================
<?php // my login in TCXC $api_login ="Enter Buyer Username"; //my API key $api_key = 'PASTE API KEY HERE'; // initialising CURL $ch = curl_init(); //controller is a script name, so in case lookup.php controller is lookup $controller = "accounts"; //unix timestamp to ensure that signature will be valid temporary $ts = time(); //compose signature concatenating controller api_key api_login and unix timestamp $signature = hash( 'sha256', $controller . $api_key . $api_login . $ts); $params = array( 'ts' => $ts, //provide TS 'signature' => $signature, 'api_login' => $api_login, 'webapi' => 1, // required settings, do not change. 'download' => 584 // Use the i_tariff value for the seller rate you'd like to download ); //query against api. URL curl_setopt($ch, CURLOPT_URL,"https://members.telecomsxchange.com/$controller.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); //curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_output = curl_exec ($ch); curl_close ($ch); //analyze JSON output echo "server_output:$server_output"; ?>