You can choose between three different api protocols. JSON, XML and
SOAP are supported by the zanox api. If no version is given the latest
version is always used.
---
Usage example: creating api instance
use soap api interface and the latest version
$api = ApiClient::factory(PROTOCOL_SOAP, VERSION_DEFAULT);
use xml api interface and the latest vesion
$api = ApiClient::factory(PROTOCOL_XML, VERSION_DEFAULT);
use json api interface and latest version
$api = ApiClient::factory(PROTOCOL_JSON);
--- /** * @param $credentials */ public function login($credentials) { $api = \ApiClient::factory(PROTOCOL_SOAP, VERSION_2011_03_01); $connectId = $credentials['connectid']; $secretKey = $credentials['secretkey']; $api->setConnectId($connectId); $api->setSecretKey($secretKey); $this->_apiClient = $api; }
/** * Constructor. * @param $affiliateWindow * @return Oara_Network_Publisher_Zn_Api */ public function __construct($credentials) { $api = ApiClient::factory(PROTOCOL_SOAP, VERSION_2011_03_01); $connectId = $credentials['connectId']; $secretKey = $credentials['secretKey']; //$publicKey = $credentials['publicKey']; $api->setConnectId($connectId); $api->setSecretKey($secretKey); //$api->setPublicKey($publicKey); $this->_apiClient = $api; }
private function conexao_zanox() { if (empty($this->api)) { //$this->api = ApiClient::factory(PROTOCOL_XML, VERSION_DEFAULT); $this->api = ApiClient::factory(PROTOCOL_SOAP, VERSION_DEFAULT); //$this->api = ApiClient::factory(PROTOCOL_JSON, VERSION_DEFAULT); $this->connectId = "3D536CE42D798BBAA2D7"; $this->secretKey = "0aeD8Fd923ee48+d8f31715e7973a6/3a179dc4d"; if (!empty($this->api)) { $this->api->setConnectId($this->connectId); } } else { return $this->api; } }