I'm having fun with RESTXQ, this is an easy and efficient way to create REST interfaces once you learn how.
Two questions:
1. How do I return a forest of elements? Multi-part MIME types? If so, how do I specify that? What do I need to add to this particular declaration?
(:~ Look up all entries in the Abbott-Smith lexicon that contain an English word in the gloss. :) declare %rest:path("/api/abbott-smith/gloss/{$g}") %rest:GET %output:method('xml') function as:gloss($g) { $as:abbott-smith/*:entry[.//*:gloss[contains-token(lower-case(.), lower-case($g))] ] };
2. Can I use query strings to specify parameters in RESTXQ? What if I want URLs like this:
/api/dictionary/?lemma=cheese
Thanks!
Jonathan
Hi Jonathan,
- How do I return a forest of elements?
It depends ;) What will your client do with the response? If you talk about a »forest of elements«, is it equivalent to a »sequence of elements«?
- Can I use query strings to specify parameters in RESTXQ? What if I want URLs like this:
Absolutely. I hope that our documentation gives you some clues on how to proceed.
Best, Christian
basex-talk@mailman.uni-konstanz.de