Accessing wiki tables via REST

Hello All,

I’m wondering what the correct RESTful way to access elements in a table defined using standard xwiki markup is.
e.g.:

(% class="doOddEven filterable grid sortable" id="tableid" %)
(% class="sortHeader" %)|=Title 1|=Title 2
|Cell 11|Cell 12
|Cell 21|Cell 22

Ideally I would like to avoid writing a macro as I need to import a lot of documents from external sources and this would add an extra step. I presume it would also make future editing of the tables less user friendly as the tables would no longer be editable inline.

Thanks,
Ben

You cannot access the XDOM directly in REST. You can access a page source though and then parse it locally. Or you can easily create a custom REST resource by creating a page with some groovy script (for ex), accessing the XDOM content of some page and return it. Then you would access the page using the /get/action.

See https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiRESTfulAPI#HCustomresources

Interesting, so essentially you’re suggesting I parse the XDOM content and build my table up as an array when requested, rather than make the user do it when creating the page.

Have I understood that right?

hmm maybe it’s me not understanding your need. Could you explain it more precisely? For example I don’t understand what you mean by " build my table up as an array when requested, rather than make the user do it when creating the page.".

So, the query will need to be able to return a value based on the column and row key, not necessarily the whole table. Leave it with me, I’ll give it a go.