The Assembler Service provides a RESTful interface for making Assembler queries and retrieving results in either JSON or XML.

You query the Assembler Service by making a GET request to a URL that specifies the location of a content item that you wish to assemble. The URL should be of the following form:

http://[hostname:port]/[servlet-path]/[content-URI]?[query-params]

In the reference deployment of the Assembler Service, the servlet path determines the format of the Assembler response. The deployment descriptor file (web.xml) in the reference deployment defines two servlets:

The difference between the servlets is in the ResponseWriter implementation that they use. It is also possible to write an Assembler response writer that forwards the results to another servlet rather than serializing them.

The content-URI is the path to the content item to be assembled.

The Assembler servlet request URL http://www.example.com/json/browse is equivalent to passing a ContentInclude item to the Assembler assemble() method with the URI /pages/[site-ID]/browse and retrieving the results in JSON format.

Query parameters in an Assembler servlet request URL are processed the same way as in the embedded Java Assembler. For example, the URL http://www.example.com/json/browse?N=101022 with the reference Assembler servlet deployment returns the same results as http://www.example.com/discover/browse?N=101022 in the reference Java application.

The Assembler provides response writer implementations that serialize the Assembler response to JSON or XML.

The Assembler response takes the form of a content item (that is, a map of properties). The properties are key-value pairs where the key is a string and the value may be one of the following types:

This structure makes it straightforward to serialize the response to JSON.

The XML output of the Assembler (using the default XmlResponseWriter) is not SOAP-compliant. The default XML format has the following characteristics:

For convenience, the Discover Electronics reference application provides links to the JSON and XML representations of the Assembler response, which are identical to the output of the Assembler servlet. This link can be useful for debugging purposes, but it is not recommended as a primary means of querying the Assembler for JSON or XML-formatted results.


Copyright © Legal Notices