ntjp Posted January 24, 2013 Share Posted January 24, 2013 Hi I'm having a problem trying to add a SUBresource file-reference to a report unit through the REST API (this pattern happens when the main report and its sub-report are both file-references) Whichever way I try, the ReportUnitHandler for the rest API ends up calling AbstractResourceHandler->CreateChildResource which itself calls FileResourceHandler->CreateResource. However contrary to the SOAP fileResourceHandler which works fine, the REST FileResourceHandler doesn't make any any effort to check if the resourcedescriptor is for a file, or a reference. As a result com.jaspersoft.jasperserver.remote.handlers.FileResourceHandler.updateResource throws a "could not find the binary content" exception because my REST API request doesn't have any file attached to it (of course it doesnt ! ... thesubresource is just assumed to be a reference to an already existing file in the repository !)Is this a bug or am I doing anything wrong ?RegardskbPS:1) if it is indeed a bug, it would be nice to provide a source-code fix, even if it means having to recompile the server. 2) if it is not a bug, would it be possible to demonstrate how to add, through the REST API, a subresource file-reference to a report-unit ? Link to comment Share on other sites More sharing options...
pdanyliuk Posted January 24, 2013 Share Posted January 24, 2013 Hello kbYes, it is clearly a bug. You might want to open a ticket for it.What's strange is that such functionality seems to be missing from the documentation, as well as any examples of resource descriptors to show how one references a file on a server. Could you please provide us with the resource descriptor you're using in your request? This will make it much easier to respond you with the fix.With best regards, Paul Danyliuk Link to comment Share on other sites More sharing options...
ntjp Posted January 25, 2013 Author Share Posted January 25, 2013 As per your request, I've added a resource descriptor sample to my initial post for a report unit where the main report and the subreport are both file references. (I've created this descriptor directly through the web GUI; I also managed to create it without problem through SOAP). For REST, I've tried 2 approaches: 1) creating the whole resource-descriptor in one go 2) first creating the resource-descriptor without the subreport resource-descriptor (that steps works fine), then separately add the subreport resource-descriptor (couldn't manage to get that part to work) However both above-mentionned approaches failedRegardskb Link to comment Share on other sites More sharing options...
pdanyliuk Posted January 25, 2013 Share Posted January 25, 2013 Thank you. I budged the developer, with this resource he'd be able to provide you a source code fix as well as fix the bug once online. Thanks for your attentiveness. Link to comment Share on other sites More sharing options...
pdanyliuk Posted January 28, 2013 Share Posted January 28, 2013 Hello again.I am writing to inform you that the bug is fixed. Here you can find the classes affected by fixing this bug:/sites/default/files/files/affectedclassesbyfixingofbug30908restresourceno.zipThanks for using our community portal.With best regards, Paul Danyliuk Link to comment Share on other sites More sharing options...
ntjp Posted January 29, 2013 Author Share Posted January 29, 2013 Your fix worked perfectly ! Thanks a lot to everyone involved.kb Link to comment Share on other sites More sharing options...
Dhiraj Pahlani Posted July 10, 2021 Share Posted July 10, 2021 Hi,Yes, you can upload report with its subreport(s) using REST API. Refer below Wiki article, which I have created for this requirement:https://community.jaspersoft.com/wiki/uploading-reports-subreports-using-rest-api Link to comment Share on other sites More sharing options...
Solution Dhiraj Pahlani Posted July 10, 2021 Solution Share Posted July 10, 2021 Hi,Yes, you can upload report with its subreport(s) using REST API. Refer below Wiki article, which I have created for this requirement:https://community.jaspersoft.com/wiki/uploading-reports-subreports-using-rest-api Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now