php client schedule job attachment

Hi All,

I am using the php client rest api to schedule a report. I am using the following code to achieve this :

    $result = new Jasper\Job();
    $result->baseOutputFilename = $reportDet['baseOutputFilename'];
    $result->label = $reportDet['label'];
    $result->description = $reportDet['description'];
    $result->repositoryDestination['folderURI'] = $repositoryDestination['folderURI'];
    $result->repositoryDestination['overwriteFiles'] = (!empty($repositoryDestination['overwriteFiles'])) ? 'true' : 'false';
$result->repositoryDestination['sequentialFilenames'] =
(!empty($repositoryDestination['sequentialFilenames'])) ? 'true' :
    $result->outputFormats['outputFormat'] = $outputFormat['outputFormat'];
    $result->source['reportUnitURI'] = $source['reportUnitURI'];
    $result->source['parameters'] = array(
                                        'REPORT_TIME_ZONE' => array('Asia/Kolkata'),
                                        'status' => array('A')
    $result->simpleTrigger['occurrenceCount'] = $simpleTrigger['occurrenceCount'];  
    $result->simpleTrigger['recurrenceInterval'] = $simpleTrigger['interval'];
    $result->simpleTrigger['recurrenceIntervalUnit'] = $simpleTrigger['intervalUnit'];
    $result->simpleTrigger['startDate'] = $simpleTrigger['startDate'];
    $result->simpleTrigger['timezone'] = $simpleTrigger['timezone'];
    $result->mailNotification['toAddresses']['address'] = $mailNotification['toAddresses'];
    $result->mailNotification['subject'] = $mailNotification['subject'];
    $result->mailNotification['messageText'] = $mailNotification['messageText'];
    $result->mailNotification['resultSendType'] = 'SEND_ATTACHMENT';

Using the code above report is getting sent correctly as an attachment. But the attachment is empty. Could anyone let me know what I am missing ?

Also, I am using older version of php client

PHP Client (v1.0)
Published: 2012-Nov-12

and the jasper server version is 5.0.0. Can that also be a part of the problem ?



ashcsi1322's picture
Joined: Dec 6 2013 - 4:52am
Last seen: 7 years 3 months ago

Hi Ashy,

I suggest using v2.0.0 (available on github: with versions 5.0 and greater.

grantbacon - 7 years 10 months ago
Hi Grantbacon, Thanks for your suggestion. I will try the latest version. Is it possible to attach calendar control to a job in the latest api? Could you please refer to an example doing it? Thanks Ashy
ashcsi1322 - 7 years 10 months ago

Hi Ashy,

You will be able to attach a Calendar to a Job. You can find the documentation in the latest code in the /docs/ folder which will contain examples of how to do this

grantbacon - 7 years 7 months ago

0 Answers:

No answers yet