0

I work on modeshape 3.7.2 and i would like to use its REST API.

  1. First of all i would like to know whether an API exists to Retrieve a list of available nodes in a give workspace?

  2. Second how to interpret the syntax: http://<host>:<port>/<context>

    • What is <context>?
    • In the documentation they mention a Reponse 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?

user692942
  • 16,398
  • 7
  • 76
  • 175

1 Answers1

0

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 the web.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

http://<host>:<port>/<context>/<repository_name>/<workspace_name>/items/<node_path>

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:

http://localhost:8080/modeshape-rest/my-repository/default/items/a/b/c HTTP/1.1

where the actual HTTP request might look like this:

GET /modeshape-rest/my-repository/default/items/a/b/c HTTP/1.1
Host: http://localhost:8080
Accept: application/json

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.

Randall Hauch
  • 7,069
  • 31
  • 28
  • if i wpould like to produce a frontend like a directory in windows he will displaying the nodes(nt:folder type) on the left side of the table and the list of nodes(type nt; files) on the right. To do that he needs a list of nodes in a workspace. the following is the syntax of standard uri for webservices http://your_domain:port/display-name/url-pattern/path_from_rest_class ; and ur syntax of api differs. – user3514763 May 26 '14 at 15:23
  • couls you please give a web xml and a json file – user3514763 May 26 '14 at 15:30