Can not modify report unit on jasper server via Rest API


I want to modify a resource via api, The url like this :


 and the method is PUT  and the request body

    "version" : 0,

the response was shown like this

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><errorDescriptor><errorCode>not.a.file</errorCode><message>Resource /reports/cgd_eva/test_60_1 is not a file</message><parameters><parameter>/reports/cgd_eva/test_60_1</parameter></parameters></errorDescriptor>

What's wrong with this? or a report unit can not be modified.



paprajak's picture
Joined: Mar 5 2018 - 7:29pm
Last seen: 1 year 7 months ago

1 Answer:


There could be multi causes but possibly the specific error points to the content-type specified. The body should have the <reportUnit> in the resource descriptor. 

Here is a working example where I tried to modify the label of the existing report unit :

URL: http://<server>:8080/jasperserver-pro/rest_v2/resources/public/Reports/CustomerReport 


Content-Type: application/repository.reportUnit+xml



If your aim is to simply update specific elements only using 'patch' method, that didn't work for me either nor is this in the REST API guides. Its best to download the existing report resource descriptor, make the change and use the PUT method with content-type as "application/repository.reportUnit+xml" (or application/repository.reportUnit+json if  you prefer json format)   

For something like this, you need to fiddle around with the resource descriptors a bit to get it a few attempts may be required.

vchiem's picture
Joined: May 1 2017 - 5:33pm
Last seen: 13 hours 59 min ago