API Requests

All Toldya API requests are made using either the GET or POST HTTP method. See the API documentation to determine which method is required by the particular API request you want to make. In general, those API requests which are used to read records are performed using GET, while requests that add, remove or update existing records are performed using POST.

About GET Requests

For a GET request, simply call the API endpoint URL with the required parameters as in the following example (which calls the view_items method to return the list of items you have for sale):

http://toldya.com/api/?action=view_items&api_key=xxx

About POST Requests

For POST requests, use your preferred server-side language (e.g. PHP, C#, VB) or a 3rd party tool such as cURL to POST one or more fields to the API. For information about creating POST requests, please see the relevant documentation. The following example shows how to POST a request to the API by using PHP and cURL:

$post = array(
	'action'	=> 'method name',
	'api_key' 	=> 'your api key',
	'parameter'	=> 'value'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.toldya.com/api/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);

 

 

 

 

 

 

 

 

 

 


back to top