Copy reportUnit in Jasperserver using REST API

0

Hi Everyone,

I want to copy a repotUnit then need to change its content in java.

In SOAP API we have direct copy method, it was quite easy for us to copy any resource.

Since we are migrating to REST API, i am unable to copy a reportUnit. Also when i read the guide, haven't found anything.

I have gone through the code of Jasperserver source code which i downloaded from Source forge, Also , there are some test cases given but those are not working.

Lateron i tried to create a new ReportUnit. But it too got failed.

 

Any help is appreciated.

Thanks.

May The Creator bless all of us.

 

 

S Atah Ahmed Khan's picture
Joined: Mar 12 2013 - 5:19am
Last seen: 6 years 5 months ago

2 Answers:

0

Hello S Atah Ahmed Khan

Sorry for a belated response. Actually there is a possibility to copy a resource, particularly a Report Unit, to any folder using REST. Given that you are logged in as some administrator, perform the following POST request:

http://host:port/jasperserver/rest/resource/uri/to/resource?copyTo=%2Furi%2Fto%2Fdestination

Like this one:

http://localhost:8080/jasperserver/rest/resource/reports/samples/AllAcco...

Please note that slashes '/' in copyTo parameter are URL-encoded as %2F. If you're going to copy a resource, you have to specify the full path to the new resource along with its new ID, not just the folder where to copy the resource to. If you are copying an entire folder, you also specify the new path of the clone of this folder, not the parent folder under which your copied folder would be placed.

Also please don't forget to check whether your desired permissions for the copied resource/folder are preserved. This functionality is not documented for a while already (however we use it for internal purposes), so there may be reasons for this like some flaws in the service or some uncertainty. Please make sure everything works okay for you and no security breaches (e.g. unpreserved permissions) appear.

Let me know if it works for you.

Thanks for using our Community Portal.

With best regards,
Paul Danyliuk

pdanyliuk's picture
Joined: Jan 24 2013 - 3:48am
Last seen: 5 years 1 month ago
0

Hi PDANYLIUK,

Thanks, i am looking for the same.

Tested the code in JUNIT, It's working.

Now implementing the same in the application.

I will let you know if something goes wrong.

Thanks once again.

S Atah Ahmed Khan.....

S Atah Ahmed Khan's picture
Joined: Mar 12 2013 - 5:19am
Last seen: 6 years 5 months ago
Feedback
randomness