REST Web Service API: upload/update report template

∥☆過路亽.° 提交于 2019-12-03 20:17:16
Nikita Bosik

This works for Jasper 5.5+ (but does not for 5.1-, returns just 404 Not Found "Specified page not found" instead).

Uploading

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..."
        }
    }
}

Updating

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..."
        }
    }
}

References:

We ended up with writing proprietary local JAVA application with jasper libraries, which does same thing

It looks like this is doable in older jasper versions (> 5.2):

they simplified significally REST API (look for API v2)

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

With the completion of the v2 REST API, Jaspersoft announces the deprecation of the original REST API and the end-of-life of the SOAP services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!