The below Quickstart script allows you to pull SDRs for your buyer account on TelecomsXChange via application programming interface. 



Endpoint:https://api.telecomsxchange.com/buyers/smshistory


Required Parameters:


'signature' => $signature, 
'api_login' => $api_login,
'prefix' => '',                         // Country Prefix, leave empty for all
'sent' => '1',                        // Show Successful only, set to 0 for failed
'date_from' => '2018-09-24 17:49:30',   // FROM DATE 
'date_to' => '2019-09-25 17:49:30' );   // TO DATE



Quickstart Script

<?php

// TCXC Buyer Login
$api_login ="USERNAME";

//TCXC Buyer API KEY
$api_key = "YOUR API KEY";


// initialising CURL
$ch = curl_init();

//controller is a script name, so in case c_sms the controller is c_sms
$controller = "c_sms";

//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,
                'prefix' => '',                        // Country prefix or empty for all.
                'sent' => '1',                         // 1 for successfull SDRs and 0 for Failed SDRs
                'date_from' => '2018-09-24 17:49:30',  // FROM DATE 
                'date_to' => '2019-09-25 17:49:30'     // TO DATE
                );


curl_setopt($ch, CURLOPT_URL,"https://api.telecomsxchange.com/buyers/smshistory");

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);
echo "server_output:$server_output \nparams:".http_build_query($params);


?>


JSON Response:


server_output:{
    "status": "success",
    "sms": [
        {
            "i_message": "44200",
            "message_id": "gKL510NoFcjyuFYA95g15ajIt1enq-RBaopf",
            "ts": "2019-08-27 09:11:25",
            "delivered": "1",
            "sent": "1",
            "i_account": "10",
            "i_customer": "1",
            "i_connection": "0",
            "i_vendor": "13",
            "message_text": "\u0422\u0435\u0441\u0442",
            "from_number": "380913104703",
            "to_number": "380671234567",
            "i_rate": "0",
            "delivered_in_sec": "1",
            "error_text": null,
            "billed_msgs_cnt": "1",
            "vendor_name": "Nexmo",
            "account_name": "SMS_XTest",
            "connection_name": null,
            "country_name": "UKRAINE",
            "description": "Mobile - Kyivstar",
            "billing_price_1": 0,
            "billing_price_n": 0,
            "customer_amount": 0
        },
        {
            "i_message": "44198",
            "message_id": "xeWmlikh7AanKpVhgMgAB2jjzQ8z2CZKF84z",
            "ts": "2019-08-22 13:04:39",
            "delivered": "1",
            "sent": "1",
            "i_account": "10",
            "i_customer": "1",
            "i_connection": "0",
            "i_vendor": "13",
            "message_text": "Test",
            "from_number": "380632960026",
            "to_number": "12014748922",
            "i_rate": "0",
            "delivered_in_sec": "1",
            "error_text": null,
            "billed_msgs_cnt": "1",
            "vendor_name": "Nexmo",
            "account_name": "SMS_XTest",
            "connection_name": null,
            "country_name": "United States of America",
            "description": "Fixed - ROC",
            "billing_price_1": 0,
            "billing_price_n": 0,
            "customer_amount": 0
        },
        {
            "i_message": "44197",
            "message_id": "0VxCcN41o69OWssj9Skk-hViOb3YNz6ECAgq",
            "ts": "2019-08-14 15:08:59",
            "delivered": "1",
            "sent": "1",
            "i_account": "10",
            "i_customer": "1",
            "i_connection": "0",
            "i_vendor": "13",
            "message_text": "Hi",
            "from_number": "380913104703",
            "to_number": "380677777777",
            "i_rate": "0",
            "delivered_in_sec": "1",
            "error_text": null,
            "billed_msgs_cnt": "1",
            "vendor_name": "Nexmo",
            "account_name": "SMS_XTest",
            "connection_name": null,
            "country_name": "UKRAINE",
            "description": "Mobile - Kyivstar",
            "billing_price_1": 0,
            "billing_price_n": 0,
            "customer_amount": 0
        },
        {
            "i_message": "44196",
            "message_id": "P200J_AfBMLOBi3q_SQJ81JrlJ8CS-chs4MB",
            "ts": "2019-08-10 11:45:08",
            "delivered": "1",
            "sent": "1",
            "i_account": "10",
            "i_customer": "1",
            "i_connection": "0",
            "i_vendor": "13",
            "message_text": "Test",
            "from_number": "96173764000",
            "to_number": "12014748922",
            "i_rate": "0",
            "delivered_in_sec": "1",
            "error_text": null,
            "billed_msgs_cnt": "1",
            "vendor_name": "Nexmo",
            "account_name": "SMS_XTest2",
            "connection_name": null,
            "country_name": "Lebanon",
            "description": "Mobile",
            "billing_price_1": 0,
            "billing_price_n": 0,
            "customer_amount": 0
        },