I work on ModeShape 3.7.2 and i would like to use its REST API.
First of all I would like to know whether an API exists to Retrieve a list of available nodes in a give workspace?
Second how to interpret the syntax:
http://<host>:<port>/<context>
- What is
<context>
? - In the documentation they mention a
Response
format: Does this mean I should change the config.json file ?
Similarly to create a node: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/items/<node_path>
What does the URI parameters stands for:
<context>
<workspace_name>
<node_path>
Here is the link for the URL syntax.
Is there any example for each of above cases?
First, there is no method in ModeShape's RESTful service to return all nodes from a repository. A repository can have millions of nodes with lots of content, so such a request would be make no sense and could have a monstrously-large response. Instead, there are methods to return some/all of the children (or descendants up to some depth) under a parent.
Secondly, the "context" is a term used in servlet-based applications, and typically refers to the location where the application is started within the server. By default this is "
modeshape-rest
", although you can change it to something else by modifying theweb.xml
in the WAR file.The "response format" is typically JSON.
The RESTful service can access multiple repositories deployed in the same server, so in the URL format
the variables in angle brackts(e.g., "
<repository_name>
") would be replaced with the actual value. For example, if the RESTful service is accessible on the local machine on port 8080 in the default app context "modeshape-rest
" in the repository named "my-repository
" with workspace "default
", you can get the node at the path "/a/b/c
" by making an HTTP GET request at this URL:where the actual HTTP request might look like this:
and the response will be a JSON file describing the node. All of the other methods on the RESTful service use a similar pattern and are described in the service documentation.