Nutzen der TecArt-System API:
Um API-Funktionen nutzen zu können, muss die API-Klasse eingebunden werden.
Die Datei liegt im TecArt-System Source-Code.
Beispiel: Liegt der TecArt-System Source-Code im Ordner /var/www , so können Sie die Klassen wie folgt einbinden:
require_once "/var/www/crm/class/api/crmapi.class.php";
Um einen Benutzer am TecArt-System zu authentifizieren werden Benutzername und Kennwort verwendet. Sie können entweder die Funktion login() nutzen, um den Benutzer zu authentifizieren.
$crmlogon->Login($username, $password)
Wenn Sie bereits eine Session-Id haben, ist es lediglich notwendig die Ping()-Funktion zu verwenden.
$crmlogon->Ping($session_id);
Beispiel 1 (session_id ist nicht vorhanden) :
<?php // include the crmapi file require_once "/var/www/crm/class/api/crmapi.class.php"; try { // get the api-logon class $crmlogon = crmapi::logon(); // login to TecArt-System $crmlogon->Login('test', 'test'); $session_id = $crmlogon->getSessionId(); } catch (CRMException $e) { echo $e->getMessage(); } /*** the API functions can be used from here. ***/
Beispiel 2 (session_id ist verfügbar) :
<?php // include the crmapi file require_once "/var/www/crm/class/api/crmapi.class.php"; try { // get the api-logon class $crmlogon = crmapi::logon(); // validate the session id $crmlogon->Ping($session_id); } catch (CRMException $e) { echo $e->getMessage(); } /*** the API functions can be used from here. ***/