Job Descriptor when uploading via REST api

0

I'm currently trying to schedule a job using the REST api for Jasper Server 5.1 (community and pro) and as a result of uploading what appears to be a valid job descriptor:

<job>
    <baseOutputFilename>AllAccounts</baseOutputFilename>
    <description>sample</description>
    <label>sample</label>
    <outputFormats>PDF</outputFormats>
    <outputLocale></outputLocale>
    <parameters>
        <name>REPORT_TIME_ZONE</name>
        <value xsi:type='xs:string' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>Australia/Sydney</value>
    </parameters>
    <repositoryDestination>
        <folderURI>/public/Samples/Reports</folderURI>
        <outputDescription></outputDescription>
        <overwriteFiles>false</overwriteFiles>
        <sequentialFilenames>false</sequentialFilenames>
        <version>0</version>
    </repositoryDestination>
    <simpleTrigger>
        <startDate>2013-06-19T07:29:52+10:00</startDate>
        <timezone>Australia/Sydney</timezone>
        <version>0</version>
        <occurrenceCount>1</occurrenceCount>
    </simpleTrigger>
    <version>0</version>
</job>
 
Performing a PUT ( scheduling a new job) or downloading a manually scheduled job descriptor and performing a POST to the jasperserver-pro/rest/job/ endpoint, results in the following 400 bad request message:
 
please check the request job descriptor
 
Because the JAXB conversion is surpressing the error message I'm unable to see what is wrong with my job descriptor being uploaded. As mentioned I've tried creating a job descriptor identified in http://community.jaspersoft.com/sites/default/files/docs/jasperreports-s... as well as downloading an existing scheduled job and just reuploading in the manner described in the web service guide and both result in the same error. Require assistance in identifying what I'm doing wrong.
gwhitaker's picture
Joined: Apr 25 2012 - 4:36pm
Last seen: 6 years 1 week ago

Hello, In your xml descriptor file you haven't specified the source resource URI and output format should be added with in one more tag. I have tried the below xml and it worked for me.

<job>
<baseOutputFilename>AllAccounts</baseOutputFilename>
<description>sample</description>
<label>sample</label>
<outputFormats><outputFormat>HTML</outputFormat></outputFormats>
<outputLocale></outputLocale>
<source><reportUnitURI>/public/Samples/Reports/13g.TopFivesReport</reportUnitURI></source>
<repositoryDestination>
<folderURI>/public/Samples/Reports</folderURI>
<outputDescription></outputDescription>
<overwriteFiles>false</overwriteFiles>
<sequentialFilenames>false</sequentialFilenames>
<version>0</version>
</repositoryDestination>
<simpleTrigger>
<startDate>2018-04-04T17:28:03.598+05:30</startDate>
<timezone>Asia/Calcutta</timezone>
<version>0</version>
<occurrenceCount>1</occurrenceCount>
</simpleTrigger>
<version>0</version>
</job>

ramu_1 - 1 year 3 months ago

2 Answers:

0

I don't see a source seciont in your job descriptor. In this section you indicate the uri from the report source, as well as any parameters you want to pass to the server:

 

<source><reportUnitURI>/path/to/report</reportUnitURI><parameters><entry><key>PARAM_KEY</key><value>PARAM_VALUE</value></entry></parameters></source>

felipegdr's picture
Joined: Apr 20 2012 - 3:51am
Last seen: 2 years 6 months ago

sorry I couldn't get the xml format to work....

felipegdr - 5 years 10 months ago

''

ramu_1 - 1 year 3 months ago
0

Hello, In your xml descriptor file you haven't specified the source resource URI and output format should be added with in one more tag. I have tried the below xml and it worked for me.

<job>
<baseOutputFilename>AllAccounts</baseOutputFilename>
<description>sample</description>
<label>sample</label>
<outputFormats><outputFormat>HTML</outputFormat></outputFormats>
<outputLocale></outputLocale>
<source><reportUnitURI>/public/Samples/Reports/13g.TopFivesReport</reportUnitURI></source>
<repositoryDestination>
<folderURI>/public/Samples/Reports</folderURI>
<outputDescription></outputDescription>
<overwriteFiles>false</overwriteFiles>
<sequentialFilenames>false</sequentialFilenames>
<version>0</version>
</repositoryDestination>
<simpleTrigger>
<startDate>2018-04-04T17:28:03.598+05:30</startDate>
<timezone>Asia/Calcutta</timezone>
<version>0</version>
<occurrenceCount>1</occurrenceCount>
</simpleTrigger>
<version>0</version>
</job>

ramu_1's picture
12
Joined: Feb 13 2018 - 9:20pm
Last seen: 2 hours 31 min ago
Feedback
randomness