【问题标题】:REST Web Service API: upload/update report templateREST Web 服务 API:上传/更新报告模板
【发布时间】:2012-09-26 07:13:07
【问题描述】:

我想用我的代码存储和部署报告模板。

考虑到这一点,运行报告是一个两步过程:

  • 上传或更新现有报告模板jrxml(它没有指向其他资源如图片的链接)
  • 用我的数据运行它(这个是done

官方文档没有包含更新报告模板的最小示例

通过JasperReports Server REST API上传/更新报告模板xml的原始请求是什么?

我试过这种方式

这是我的raw request

这里是response

这里是我在/var/lib/tomcat6/webapps/jasperserver/WEB-INF/logs/jasperserver.log看到的

我做错了什么? 400 error: could not find the binary content for resource: /Reports/product_structures_workshops 是什么意思?

【问题讨论】:

  • 您是在谈论 JR Server 还是一些自定义应用程序?
  • 我正在将 JR Server 与我的应用程序集成
  • @Alex K,我在哪里可以获得 RESTServlet.java 源代码? (com.jaspersoft.jasperserver.rest.RESTServlet)。我不想下载整个源代码树
  • 检查this link。登录名\密码:anonsvn\anonsvn
  • 谢谢,你让我开心(我找到了 REST 测试)

标签: rest jasper-reports jasperserver


【解决方案1】:

这适用于 Jasper 5.5+(但不适用于 5.1-,只返回 404 Not Found“未找到指定页面”)。

上传中

POST http://your-host:port/jasperserver/rest_v2/resources/path/to/resource/

Content-Type: application.repository.reportUnit+json

{
    "label": "Sample",
    "jrxml": {
        "jrxmlFile": {
            "label": "MyJRXML",
            "type":"jrxml",
            // encode your file in Base64 and put here
            "content": "PD94bWwg..."
        }
    }
}

更新中

PUT http://your-host:port/jasperserver/rest_v2/resources/path/to/resource/myReport/

Content-Type: application.repository.reportUnit+json

{
    "label": "Sample",
    "jrxml": {
        "jrxmlFile": {
            "label": "MyJRXML",
            "type":"jrxml",
            // encode your file in Base64 and put here
            "content": "PD94bWwg..."
        }
    }
}

参考资料:

【讨论】:

    【解决方案2】:

    我们最终用 jasper 库编写了专有的本地 JAVA 应用程序,它做同样的事情

    看起来这在较旧的 jasper 版本(> 5.2)中是可行的:

    他们显着简化了 REST API(寻找 API v2)

    https://community.jaspersoft.com/wiki/getting-started-rest-web-service-api

    随着 v2 REST API 的完成,Jaspersoft 宣布 原始 REST API 的弃用和 SOAP 的生命周期结束 服务

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-04
    • 1970-01-01
    • 2020-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多