Api
Aus TecArt-CRM Wiki
Klassen
- API Activities
- API Appointments
- API Calls
- API Contacts
- API Contracts
- API CTI
- API Documents
- API Emails
- API Logon
- API Offers
- API Projects
- API Tasks
- API Tickets
- API Vacations
Nutzen der CRM APIs:
Um API-Funktionen nutzen zu können, muss die API-Klasse eingebunden werden.
Die Datei liegt im CRM-Source-Code.
Beispiel: Liegt der CRM-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 CRM System zu authentifizieren werden Benutzername und Kennwort verwendet. Sie können entweder die Funktion login() oder die Funktion loginMD5() nutzen, um den Benutzer zu authentifizieren.
$crmlogon->Login($username, $password)
oder
$crmlogon->LoginMD5($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 CRM $crmlogon->Login('test', 'test'); // or $crmlogon->LoginMD5( 'test', md5('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. ***/ ?>