使用 RestAPI 的 Jasper 报告

问题描述 投票:0回答:2

我有一份关于 JasperServer(5.6) 的报告,它接受很少的参数。我在“输出选项”选项卡上编辑一些设置,并在“通知”选项卡上输入我想要发送的电子邮件。报告已成功生成,并且电子邮件已完美发送。

我希望使用 JasperServer 的 Rest API 来传递我的输入选项并安排和通过电子邮件发送报告。我浏览了那里的文档 http://community.jaspersoft.com/documentation/jasperreports-server-web-services-guide/v56/rest-v2-report-services 但无法理解如何使用其余 api。

这是我在 jasper 服务器上的报告的属性

有人可以帮助我如何安排我的报告吗?

rest jasperserver
2个回答
0
投票

也许它可以帮助你:jasperserver Rest java client。 这是 Jasperserver 的 REST 客户端。


0
投票

我想,我已经找到了在 jasper 服务器上安排工作的方法。详情可以看这里

http://community.jaspersoft.com/documentation/tibco-jasperreports-server-web-services-guide/v62/scheduling-report

但作为一个例子,它是(用 PUT 方法调用它) http://localhost:8080/jasperserver/rest_v2/jobs 并在正文中定义工作结构


     {
        "id": 3819,
        "version": 2,
        "username": "jasperadmin",
        "label": "publisher_123_report",
        "description": "",
        "creationDate": "2015-12-30T02:02:40.382+03:00",
        "trigger": {
            "simpleTrigger": {
              "id": "1770",
              "misfireInstruction": "0",
              "startDate": "2015-12-20T00:00:00+11:00",
              "startType": "2",
              "timezone": "Australia/Victoria",
              "version": "0",
              "occurrenceCount": "1"
            }
        },
        "source": {
              "reportUnitURI": "/Reports/Prod/test_automated_report_v14",
              "parameters": {
                 "parameterValues": {
                        "PublisherId" : "20",
                       "MonthEnd" : "2015-02-01",
                       "MonthStart" : "2015-03-20",
                       "email" : "[email protected]",
                       "CountryCode" : "560"
                 }
              }
        },
        "baseOutputFilename": "publisher_124_automated_report",
        "outputLocale": "",
        "mailNotification": {
            "subject": "publisher monthly report" ,
            "toAddresses": {
                "address": ["[email protected]", "[email protected]"]
            },
            "ccAddresses": {
                "address": ["[email protected]", "[email protected]"]
            },
            "bccAddresses": {
                "address": ["[email protected]", "[email protected]"]
            }, 
            "includingStackTraceWhenJobFails" : false,
            "resultSendType" : "SEND_EMBED",
            "skipEmptyReports" : true,
            "skipNotificationWhenJobFails" : false   
        },
        "alert": {
            "id": 0,
            "version": -1,
            "recipient": "OWNER_AND_ADMIN",
            "toAddresses": {
                "address": ["[email protected]", "[email protected]"]
            },
            "jobState": "FAIL_ONLY",
            "messageText": "Success",
            "messageTextWhenJobFails": "Failure",
            "subject": "Notification Subject",
            "includingStackTrace": true,
            "includingReportJobInfo": true,
            "jobState" : "ALL"
        },
        "outputTimeZone": "Australia/Melbourne",
        "repositoryDestination": {
            "id": 3817,
            "version": 0,
            "folderURI": "/Reports/Prod",
            "sequentialFilenames": false,
            "overwriteFiles": false,
            "outputDescription": "",
            "timestampPattern": null,
            "saveToRepository": true,
            "defaultReportOutputFolderURI": null,
            "usingDefaultReportOutputFolderURI": false,
            "outputLocalFolder": null,
            "outputFTPInfo": {
                "userName": null,
                "password": null,
                "folderPath": null,
                "serverName": null
            }
        },
        "outputFormats": {
            "outputFormat": ["HTML"]
        }
    }

创建作业时可以提供更多选项。

© www.soinside.com 2019 - 2024. All rights reserved.