FAQ - HelpDesk 3 - Api

HelpDesk 3 - Api

25.09.2017 382


HelpDesk 3 has a great client api integrated. You can integrate this into your own website where your client create a user or change their data or delete their user profile. You need curl installed on your server and pass the vars to your HelpDesk 3 installation, it will then create, update or delete a user from your HelpDesk 3 client database.

Should you run our CMS you can also share the hashed password so clients don't need to have two passwords.

$CD_URL = "url_where_helpdesk_has_been_installed"; // url to the helpdesk installation
$CD_API_KEY = ""; // can be found in your operator panel - settings
$CD_SID_KEY = ""; // can be found in your operator panel - settings
$CD_ACTION = "new"; // (new,update,delete)
$CD_NAME = ""; // name from client
$CD_EMAIL = ""; // valid email address from client
$CD_OLDEMAIL = ""; // valid old email address from client (same as above or old one in case of a change)
$CD_HASHEDPASS = ""; // password hash from CMS
$CD_CHATDEP = "1"; // (single id or multiple id's (1,2,3))
$CD_SUPPORTDEP = "1"; // (single id or multiple id's (1,2,3))
$CD_FAQCAT = "1"; // (single id or multiple id's (1,2,3))
$CD_CREDITS = "0"; // (numeric )
$CD_VALIDTILL = ""; // (0000-00-00 / Year-Month-Day)
	
$CD_STR = urlencode("sid=".$CD_SID_KEY."&action=".$CD_ACTION."&name=".$CD_NAME."&email=".$CD_EMAIL."&oldemail=".$CD_OLDEMAIL."&pass=".$CD_HASHEDPASS."&chatdep=".$CD_CHATDEP."&supportdep=".$CD_SUPPORTDEP."&faqcat=".$CD_FAQCAT."&credits=".$CD_CREDITS."&valid=".$CD_VALIDTILL);
	
$CD_STR = (trim(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $CD_API_KEY, $CD_STR, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
	
$CD_CURL = curl_init();
	
// set URL and other appropriate options
curl_setopt($CD_CURL, CURLOPT_URL, $CD_URL.'/index.php?p=api&sp='.bin2hex($CD_STR));
curl_setopt($CD_CURL, CURLOPT_SSL_VERIFYPEER,  false);
curl_setopt($CD_CURL, CURLOPT_HEADER, 0);
	
// grab URL and pass it to the browser
curl_exec($CD_CURL);
	
// close cURL resource, and free up system resources
curl_close($CD_CURL);

In case you are using the rewrite mode, please use following URL instead:

curl_setopt($CD_CURL, CURLOPT_URL, $CD_URL.'/api/'.bin2hex($CD_STR));