Hi Nigel,
thanks for the detailed wish list. First of all, I'd advise to follow the steps described at http://basex.org/rest. This tutorial seems to be well accepted by our users. As you might have seen, it's still based on version 6.1, so it will be updated with the next official release.
- Start the REST service.
==========================
When I start the BaseX server by doing;
C:>java -cp basex-6.3.jar org.basex.BaseXServer -s
does that also start the REST service?
No; the Jetty server and some other external libraries are needed to run the REST service; these aren't included in the default distribution of BaseX (which doesn't rely on any external packages), but found in the basex-api.zip package instead. We'll soon automatize the process of including a runnable REST/JaxRx version in each minor release.
- Test the rest service.
=========================
How can I test if the REST service is running on localhost? Pointing a browser at http://localhost:8984/basex/jax-rx/ returns the following error;
If you follow the tutorial, you shouldn't encounter any problems; just tell us if you need an updated, precompiled version of the basex-api.zip distribution package. Note, next, that all browsers will give you different results. Some browsers will display the result as XML, whereas others (such as Chrome) doesn't show anything. You might try tools like 'curl' to get all output printed on screen.
Connection refused: connect
This indicates that the web server hasn't been started; see 1.
- Using REST.
============== How do I create a restful interface? Say I want to create a REST API that simply does the following;
An HTTP GET to locahost:8984/basex/jax-rx/foo/ returns <hello/> An HTTP GET to locahost:8984/basex/jax-rx/bar/ returns <world/>
Hm, I'm not sure what you want to do here. If your database "foo" includes the document "<hello/>", you'll indeed get this result.
Note that the next version of REST/JaxRx, on which we're currently working, will support hierarchical paths; i.e., you'll be able to watch parts of a database by specifying the correspondent collection path. An example:
locahost:8984/basex/jax-rx/YourDB/path/to/relevant/documents?query=query/to/be/executed
Hope thie helps, Christian
basex-talk@mailman.uni-konstanz.de