Textlocal Logo

API Documentation

Get Survey Details

This command will get a number of details about a given survey.

Resource URL

https://api.txtlocal.com/get_survey_details/

Sample Request

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

	// Survey details
	$survey_id = 123456;

	// Prepare data for POST request
	$data = array('apikey' => $apiKey, 'survey_id' => $survey_id);
 
	// Send the POST request with cURL
	$ch = curl_init('https://api.txtlocal.com/get_survey_details/');
	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');
	
	// Survey details
	$survey_id = '123456';

	// Prepare data for POST request
	$data = 'apikey=' . $apiKey . '&survey_id=' . $survey_id;
 
	// Send the GET request with cURL
	$ch = curl_init('https://api.txtlocal.com/get_survey_details/?' . $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');
	
	$survey_id = 18;
	$start_date = '2013-08-03 00:00:00';
	$end_date = '2013-08-04 00:00:00';
	
	$response = $Textlocal->getSurveyDetails($survey_id);
	print_r($response);
?>

Parameters

survey_id The ID of the survey found in get_surveys.
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.

Sample Response

{
	"survey_details":[{
		"id":"1234",
		"title":"My Survey",
		"description":"An amazing customer survey",
		"published":"y",
		"hex":"ABC123",
		"startDatetime":"1970-01-01 00:00:00",
		"endDatetime":"2100-01-01 00:00:00"
	}],
	"status":"success"
}
<?xml version="1.0" encoding="UTF-8" ?>
<response>
	<survey_details>
		<survey_detail>
			<id>1234</id>
			<title>My Survey</title>
			<description>An amazing customer survey</description>
			<published>y</published>
			<hex>ABC123</hex>
			<startDatetime>1970-01-01 00:00:00</startDatetime>
			<endDatetime>2100-01-01 00:00:00</endDatetime>
		</survey_detail>
	</survey_details>
	<status>success</status>
</response>

Errors

Error Codes
49 Invalid survey ID.
58 No survey ID specified.