Issue DescriptionI have an existing ReportUnit resource that I would like to modify using the REST v2 API. When I attempted to update the "resources" field of this ReportUnit like this: | [toc] |
{ "version":0, "patch":[ { "field":"resources", "value":"[URI OF RESOURCE HERE]" } ] }
I got the error:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <errorDescriptor> <errorCode>patch.failed</errorCode> <message> EL1010E:(pos 0): Field or property resources cannot be set on object of type com.jaspersoft.jasperserver.dto.resources.ClientReportUnit </message> <parameters> <parameter> resources = "[URI OF RESOURCE HERE]" </parameter> </parameters> </errorDescriptor>
Resolution
Use this JSON syntax:
{ "version":0, "patch":[ { "expression": "files.put('test_file', new com.jaspersoft.jasperserver.dto.resources.ClientReference().setUri('/public/Samples/Resources/Images/ico-library.jpg'))" } ] }
"files" is used instead of "resources" because ClientReportUnit doesn't have any "resources" field.
It has a "files" field, which is java.util.Map, and it's being mapped to "resources" for convenience.
You can look in our jasperserver-dto package to see the actual Java structure of classes to patch.
The PATCH Method was introduced in JasperReports Server v5.5, and it is discussed in the Web Services Guide PDF that comes with JasperReports Server.
Ref. Case 00057949
Recommended Comments
There are no comments to display.