Textlocal Logo

API Documentation

Get Email to SMS Message History

This command will retrieve history of single messages sent through the Email to SMS gateway.

Resource URL

https://api.txtlocal.com/get_history_email/

Sample Request

<?php
	// Account details
	$apiKey = urlencode('Your apiKey');

	// Prepare data for POST request
	$data = array('apikey' => $apiKey);
 
	// Send the POST request with cURL
	$ch = curl_init('https://api.txtlocal.com/get_history_email/');
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$response = curl_exec($ch);
	curl_close($ch);
	
	// Process your response here
	echo $response;
?>
<?php
	// Account details
	$apiKey = urlencode('Your apiKey');

	// Prepare data for POST request
	$data = $apiKey;
 
	// Send the GET request with cURL
	$ch = curl_init('https://api.txtlocal.com/get_history_email/?' . $data);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$response = curl_exec($ch);
	curl_close($ch);
	
	// Process your response here
	echo $response;
?>
<?php
	require('Textlocal.class.php');

	$Textlocal = new Textlocal(false, false, 'your apiKey');
	
	$min_time = time(); // Get sends between now 
	$max_time = strtotime('-1 month'); // and a month ago 
	$limit = 1000;
	$start = 0;
	
	$response = $Textlocal->getEmailToSMSHistory($start, $limit, $min_time, $max_time);
	print_r($response);
?>

Parameters

Login Parameters (Additional Information)
apiKey You can create these in your Messenger Control Panel (click here) for each application, and limit the usage of them by host IP Address.
Optional Parameters
min_time Unix timestamp format of the oldest message. If not provided defaults to 6 months ago as of today.
max_time Unix timestamp format of the newest message. If not provided defaults to current time.
sort_order Order in which to sort the response. Either asc or desc. If not provided defaults to desc.
start Used in conjunction with limit to return a set of messages starting at the position given (such as 24), up to and including the limit.
limit Limit result set returned to a specific number of records. If not provided defaults to 1000.

Sample Response

{
	"start":0,
	"limit":1000,
	"total":2,
	"messages":[{
		"number":447123456789,
		"content":"This is your message",
		"datetime":"2013-07-04 12:22:29",
		"status":"D"
	},
	{
		"number":447987654321,
		"content":"This is your other message",
		"datetime":"2013-07-03 14:06:35",
		"status":"D"
	}],
	"status":"success"
}
<?xml version="1.0" encoding="UTF-8" ?>
<response>
	<start>0</start>
	<limit>1000</limit>
	<total>2</total>
	<messages>
		<message>
			<number>447123456789</number>
			<content>This is you message</content>
			<datetime>2013-07-04 12:22:29</datetime>
			<status>D</status>
		</message>
		<message>
			<number>447987654321</number>
			<content>This is your other message</content>
			<datetime>2013-07-03 14:06:35</datetime>
			<status>D</status>
		</message>
	</messages>
	<status>success</status>
</response>

Errors

Error Codes
45 Invalid sort field.
46 Invalid limit value.
47 Invalid sort direction.
48 Invalid timestamp.
63 Invalid start specified.