Hi Manish, = Short answer =
There is no REST API to help you do it faster, you have to do it on your own, by getting the page and all its metadata and saving it in a new location with a new name. = Long answer / proposal = Maybe I`m wrong, but, as operations, REST only supports the basic HTTP protocol operations: PUT, GET, POST and DELETE. Translated to application operations, you have Create, Retrieve, Update and Delete (CRUD). These are basic operations that can be composed to create more "complex" ones like copy (retrieve+create), rename(retrieve+create+delete), etc. While this is powerful enough to create any operation you would like, it's also a bit limiting for an application's scope because these "new" operations have to be implemented each time by the client, instead of having them available from the application trough an API. One simple example of problem generated by this fact is that the client will perform 3 operations for a rename (retrieve page + create page in new location + delete old page location) and this will trigger 3 application events in the application's (xwiki's) notification system instead of just 1. Modules listening for page copy or page rename events will not be notified because they were listening to 1 specific event, but 3 general events were used instead. The other obvious concern is the performance of 2/3 operations (each sending and receiving data over the network) versus just 1 (possibly optimised). A "not-so-hackish" solution could be used on the application side to provide an extension to the basic HTTP operations by using parameters such as... ".../spaces/Main/pages/Test?action=copy&destination=Tests.Test", just like we do to overcome browser limitations for the HTTP method [1]. Actually, we could just extend the possible values for the "method" parameter used in [1] by adding "copy" and "rename". ------------------ References: [1] http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI#HOvercomingbrowserlimitations On Tue, Jul 12, 2011 at 5:23 PM, xManish <[email protected]> wrote: > Hi, > In XWiki, we could copy a page from one space to another space. Is there > any > thoughts about making a copy of page through RestApi. > While copying a page, all of the objects within that page should be copied > over too. > > The only way I can see it can be done now is by getting all objects of that > page, iterate through them and create them one by one. > > Is there a better solution to this? > > Thanks in advance > > Regards, > Manish > > -- > View this message in context: > http://xwiki.475771.n2.nabble.com/Copy-page-through-Restful-API-tp6575262p6575262.html > Sent from the XWiki- Dev mailing list archive at Nabble.com. > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

