Execute Cronjob
Function
As of version 7.0.0.3
POST /api/v2/api.php p_cronjob_execute=1
|
Filters
Name |
POST Key |
Type |
Required |
Comment |
Example |
Send Chat Transcripts | p_send_chat_transcripts | bool | Yes | Closed chats will be archived and chat transcripts will be sent. Call every 10-20 hours. | 1 | Receive Emails | p_receive_emails | bool | Yes | Emails will be downloaded from mailboxes. Call every 2-5 minutes. | 1 | Maintenance | p_maintenance | bool | Yes | Pruning and optimizing databases. Call every 10-120 seconds. | 1 | Social Media | p_social_media | bool | Yes | Download messages from Social Media. Call every 10-120 seconds. | 1 |
|
CURL Example
curl {yourdomain}{livezilla_folder}/api/v2/api.php -d {authenthication} -d p_cronjob_execute=1 -d p_cronjob_maintain=1 -d p_send_chat_transcripts=1 -d p_receive_emails=1 -d p_social_media=1 -X POST
|
Response
|
Error Codes
403 Forbidden: Invalid or no user authentication data sent (see General API Authentication)
400 Bad Data: Invalid or missing POST parameters (see required fields/filters and data types)
|
PHP code to execute CronJobs
<?php
$livezillaURL = "http(s)://{yourdomain}/livezilla/";
$apiURL = $livezillaURL . "api/v2/api.php";
// authentication parameters
$postd["p_user"]='{user_id}';
$postd["p_pass"]=md5('{user_password}');
// function parameter
$postd["p_cronjob_execute"]=1;
$postd["p_send_chat_transcripts"]=1;
$postd["p_receive_emails"]=1;
$postd["p_maintenance"]=1;
$postd["p_social_media"]=1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$apiURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postd));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if($server_output === false)
exit(curl_error($ch));
echo $server_output;
echo "<hr>";
curl_close($ch);
$response = json_decode($server_output);
?>