Did you check
http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI#HRootresources
?

/wikis/query
[since 6.4] using a SOLR query (there's no type parameter)

/wikis/{wikiName}/query
Allow to execute HQL, XWQL, Lucene or SOLR queries on the given {wikiName}.
(has a type parameter)

The first is a cross wiki query/search, that cannot be performed with HQL
or XWQL because each wiki is stored in a separate database schema. Solr on
the other hand keeps an external index (outside the database) that is cross
wiki.

The second REST resource targets a specific wiki (database) which allows
you to use XWQL.

Hope this helps,
Marius

On Tue, May 24, 2016 at 3:33 PM, Mark Sack <mark.s...@secti.al.gov.br>
wrote:

> I'm trying to use the REST API to retrieve some data but the API seems to
> be
> ignoring the type parameter.
> My environment is XWiki 7.4.2, Debian 8, PostgreSQL, Tomcat 8, Openjdk 8
>
> If I try to fetch some data using the browser and the following URL:
>
> http:// ...
>
> /rest/wikis/query?q=select%20obj.first_name,obj.last_name%20from%20Document%20doc,%20doc.object%28XWiki.XWikiUsers%29%20as%20obj&type=xwql
>
> the result is as follows (I'm reproducing here only the first few lines -
> there are actually 10 items returned)
>
> <searchResults
> template="
> http://10.1.16.192:8080/wiki/rest?q={solrquery}(&number={number})(&start={start})(&orderField={fieldname}(&order={asc|desc}))(&distinct=1)(&prettyNames={false|true})(&wikis={wikis})(&className={classname})
> "><searchResult><link
> href="
> http://10.1.16.192:8080/wiki/rest/wikis/xwiki/spaces/XWiki/pages/DocumentTreeMacros
> "
> rel="http://www.xwiki.org/rel/page
> "/><type>page</type><id>xwiki:XWiki.DocumentTreeMacros</id><pageFullName>XWiki.DocumentTreeMacros</pageFullName><wiki>xwiki</wiki><space>XWiki</space><pageName>DocumentTreeMacros</pageName><modified>2016-02-15T12:14:34-03:00</modified><author>xwiki:XWiki.Admin</author><version>4.1</version><score>0.75986093</score></searchResult><searchResult><link
> href="
> http://10.1.16.192:8080/wiki/rest/wikis/xwiki/spaces/Panels/pages/DocumentInformation
> "
> rel="http://www.xwiki.org/rel/page
> "/><type>page</type><id>xwiki:Panels.DocumentInformation</id><pageFullName>Panels.DocumentInformation</pageFullName><wiki>xwiki</wiki><space>Panels</space><pageName>DocumentInformation</pageName><modified>2016-01-12T09:56:52-03:00</modified><author>xwiki:XWiki.superadmin</author><version>1.1</version><score>0.63381535</score></searchResult>
>
> The result is not related in any way to the user data or their names. From
> the template on the first line, it seems to think that the query is a SOLR
> query not xwql. I've verified that the query is correct xwql syntax and
> gives a valid result by trying it in a velocity script on an actual xwiki
> page. The result is basically the same if I just query for the first name
> instead of both the first name and last name.
>
> How should I be executing xwql queries using the REST API?
>
> Regards
> Mark Sack
>
>
>
> --
> View this message in context:
> http://xwiki.475771.n2.nabble.com/REST-API-ignores-type-parameter-tp7599586.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to