API Functions Print

  • api
  • 2

Functions that are accessible through the API are the ones listed below:

 

GET

you can get data using the API using the GET function:

$url = ECOMMERCE_SUITE_URL . '/api/get/members/0/25';  //0 is the offset; 25 is the db limit

$data = array(
   'api_key' => 'xxxxxxxxxxxxxxx',
   'api_token' => 'xxxxxxxxxxxxxx',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);

if ($post == true)
{
	curl_setopt($ch, CURLOPT_POST, $post);
	curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
}

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);

//$response .= '<br />' . $url . http_build_query($data);
return $response;


POST

$url = ECOMMERCE_SUITE_URL . '/api/post/members';

		$data = array(
                        'api_key' => 'xxxxxxxxxxxxxxx',
                        'api_token' => 'xxxxxxxxxxxxxx',
			'api_command'   => 'create',
			'status'        => '1',
			'fname'         => $vars['firstname'],
			'lname'         => $vars['lastname'],
			'primary_email' => $vars['email'],
			'custom_id'     => $vars['userid'],
			'sponsor_id' => '4527',
		);

$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);

	if ($post == true)
	{
		curl_setopt($ch, CURLOPT_POST, $post);
		curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
	}

	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$response = curl_exec($ch);

	//$response .= '<br />' . $url . http_build_query($data);
	return $response;

 

 

More Sample Code:


Sample Code


Was this answer helpful?

« Back