On Tue, Jan 4, 2011 at 12:32, Phoenix Hawk <[email protected]> wrote: > On Tue, Jan 4, 2011 at 6:09 PM, Thomas Mortagne > <[email protected]>wrote: > >> Hi, >> >> On Tue, Jan 4, 2011 at 08:19, Phoenix Hawk <[email protected]> wrote: >> > Hi guys, >> > >> > I need to update wiki pages with minimum amount of data transferred >> across >> > the network. >> > >> > Current approachs I've tried are are Rest and XmlRpc but they require me >> to >> > download the entire wiki page before I can update it. >> > >> > Can anyone suggest how I can eliminate the download (it is slow and the >> 3G >> > coverage is not stable where my users are) and just simply append to the >> > top/bottom of the Wiki page directly? >> > >> > Any help/advice is deeply appreciated, thank you! >> >> I don't think there is any API to do that by default but you can >> easily add one on your wiki. >> >> The cleanest answer would probably be to add a REST resource on you >> server and use it from your client, see >> >> http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI#HCustomresources >> . >> >> A quicker way would be a to write a velocity script in a page >> responsible to append a provided String in a provided document. See >> http://platform.xwiki.org/xwiki/bin/view/DevGuide/. >> > > Hi Thomas, > > Thank you for the heads up. > > To make the wiki portable, I think I will go with the velocity script. > > Should I still be using HTTP PUT (Rest) to the page in this case? I have a > few small binary attachments to go along with the update. If not, how should > I communicate to the custom page?
Calling a page containing a script basically is the same principle than a PHP page. The idea is to send a call a wiki page exactly like it would be when you use a <form> in a page. So it's more a GET or POST request. The simplest possible way to cover you use case is to call in a browser something like http://host/xwiki/bin/get/Space/MyService?targetdocument=wiki:Space.DocumentToAppend&content=additionnal+content "get" action execute the page like "view" would do but without any UI around so that there is really only you script and nothing else. In you script you get the document to append and the content to add using $request.targetdocument and $request.content. Then it's up to you to define how your script indicate if there is an error or something like printing OK or KO etc... that part is totally free form. There is a project to make possible to write a REST resource in a page like you can do currently in java but no idea when. > > Thank you for helping me, I will put up whatever I have done into the > Extensions once I get it working. :) > > pH > _______________________________________________ > users mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/users > -- Thomas Mortagne _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
