On Fri, May 24, 2013 at 10:37 AM, <[email protected]> wrote:
Ok, it solves my problem.
Thanks a lot Thomas !
I have an other question : is it possible to specify the wiki when we do a hql or xwql query ? I saw there is a "setWiki()" method which works only if the user have programming rights. Is it possible to do this without these rights ?
The fact that it require PR was actually a bug fixed in https://jira.xwiki.org/browse/XWIKI-7756 (4.1). I updated http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module documentation.
On Fri, 24 May 2013 10:01:49 +0200, Thomas Mortagne <[email protected]> wrote:
You are mixing too things, REST API access data. There is no support for providing "official" REST reources from pages yet.
If you want to get the result of your script you need to access it through http://myhost/xwiki/get/MySpace/MyDocument?ouputSyntax=plain
On Fri, May 24, 2013 at 9:54 AM, <[email protected]> wrote:
Hi everybody,
I am new at XWiki and I would like to know if it's possible to build a JSON object in a velocity script and get later this JSON via the REST API.
This is my script :
{{velocity}}
#if($xcontext.action == 'get' && "$!{request.outputSyntax}" == 'plain') $response.setContentType('application/json') #end
#set($hql = "") #set($results = $xwiki.searchDocuments($hql)) #set($json= "[" ) #set($started = false) #foreach($item in $results) #set($itemdoc = $xwiki.getDocument($item)) #if($started) #set($pointvirgule=",") #set($json = "${json} ${pointvirgule}" ) #else #set($started = true) #end
#set($suite="{ ""name"" : ""${itemdoc.fullName}""}") #set($json= "${json} ${suite}")
#end
#set($fin="]") #set($json= "${json} ${fin}")
$json
{{/velocity}}
I thought my JSON would be in the content of my page but when I try to get this content with REST API I only have the velocity script in hard.
Someone could help me ?
Thanks in advance for your answers.
Pierrick
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne