Common UI Metadata Service
The Pentaho BI server ships a lightweight general purpose webservice for accessing metadata. This is implemented as a webservice plugin by the org.pentaho.common.ui.metadata.service.MetadataService class. This forms a more generic and independent API as compared to the (unmaintained) WAQR metadata services.
The common ui metadata service is part of the common ui plugin. You can find this in pentaho-solutions/system/common-ui
. Here's a snippet from the common-ui plugin.xml
that defines the metadata service:
  <webservice   id="metadataService"   type="xml,gwt"   />
Service API / Urls
The Common UI Metadata service can be accessed both as an ordinary non-GWT webservice and as a GWT webservice.
Non-GWT Webservice API
 All Common UI Metadata services are accessed using urls of this form:
http://localhost:8080/pentaho/content/ws-run/metadataService/<method-name>
where <method-name> represents the name of a java method of the org.pentaho.common.ui.metadata.service.MetadataService class.
The non-GWT Webservice API has both XML and JSON capabilities. Application developers can choose to use either JSON or XML, or mix and match as desired.
Methods
For an up-to-date overview of the available methods, refer to the source. At the time of writing, these methods are known:
- listBusinessModels -Â Returns a list of the available business models in XML format. Parameters:
- domainName -Â optional domain to limit the results
- context -Â Area to check for model visibility
- listBusinessModelsJson -Â Returns a list of the available business models in JSON format. Parameters:
- domainName -Â optional domain to limit the results
- context -Â Area to check for model visibility
- loadModel -Â Returns a model object for the requested model in XML format. The model will include the basic metadata: categories and columns.
- domainId - the internal id of the domain. You can retrieve this using the listBusinessModels and listBusinessModelsJson service calls
- modelId - the internal id of the model. You can retrieve this using the listBusinessModels and listBusinessModelsJson service calls
- loadModelJson - Returns a model object for the requested model in JSON format. The model will include the basic metadata: categories and columns.
- domainId - the internal id of the domain. You can retrieve this using the listBusinessModels and listBusinessModelsJson service calls
- modelId - the internal id of the model. You can retrieve this using the listBusinessModels and listBusinessModelsJson service calls
- doQuery - Executes a query model and returns a serializable result set.
- Query
- rowLimit - An optional integer indicating the maximum number of rows. -1 or null means all rows
- doXmlQuery - Executes a XML query (in MQL Vocabulary) and returns a serializable result set
- Xml Query (in MQL Vocabulary)
- rowLimit - An optional integer indicating the maximum number of rows. -1 or null means all rows
- doXmlQueryToJson -Â Executes a XML query (in MQL Vocabulary) and returns a JSON serialization of the result set
- Xml Query (in MQL Vocabulary)
- rowLimit - An optional integer indicating the maximum number of rows. -1 or null means all rows
- doXmlQueryToCdaJson - Executes a XML query (in MQL Vocabulary) and returns a CDA compatible JSON serialization of the result set
- Xml Query (in MQL Vocabulary)
- rowLimit - An optional integer indicating the maximum number of rows. -1 or null means all rows
- doJsonQuery -Â Executes a JSON query and returns a serializable result set
- JSON Query
- rowLimit - An optional integer indicating the maximum number of rows. -1 or null means all rows
- doJsonQueryToJson - Executes a JSON query and returns a JSON serialization of the result set
- JSON Query
- rowLimit - An optional integer indicating the maximum number of rows. -1 or null means all rows
- doJsonQueryToCdaJson - Executes a JSON query and returns a CDA compatible JSON serialization of the result set
- JSON Query
- rowLimit - An optional integer indicating the maximum number of rows. -1 or null means all rows
listBusinessModels
GET http://localhost:8080/pentaho/content/ws-run/metadataService/listBusinessModels <?xml version="1.0"?> <ns:listBusinessModelsResponse xmlns:ns="http://service.metadata.ui.common.pentaho.org" xmlns:ax2950="http://util.java/xsd" xmlns:ax2944="http://impl.model.metadata.ui.common.pentaho.org/xsd" xmlns:ax2942="http://logging.commons.apache.org/xsd" xmlns:ax2946="http://marshal.connection.commons.pentaho.org/xsd" xmlns:ax2947="http://connection.commons.pentaho.org/xsd" xmlns:ax2939="http://io.java/xsd" > <return type="org.pentaho.common.ui.metadata.model.impl.ModelInfo"> <domainId>steel-wheels/metadata.xmi</domainId> <modelDescription>This model contains information about Employees.</modelDescription> <modelId>BV_HUMAN_RESOURCES</modelId> <modelName>Human Resources</modelName> </return> <return type="org.pentaho.common.ui.metadata.model.impl.ModelInfo"> <domainId>steel-wheels/metadata.xmi</domainId> <modelDescription>This model contains information about products and product inventory.</modelDescription> <modelId>BV_INVENTORY</modelId> <modelName>Inventory</modelName> </return> <return type="org.pentaho.common.ui.metadata.model.impl.ModelInfo"> <domainId>steel-wheels/metadata.xmi</domainId> <modelDescription>This model contains information about customers and their orders.</modelDescription> <modelId>BV_ORDERS</modelId> <modelName>Orders</modelName> </return> </ns:listBusinessModelsResponse>
listBusinessModelsJson
GET http://localhost:8080/pentaho/content/ws-run/metadataService/listBusinessModelsJson <ns:listBusinessModelsJsonResponse xmlns:ns="http://service.metadata.ui.common.pentaho.org"> <return> [ { "class":"org.pentaho.common.ui.metadata.model.impl.ModelInfo", "domainId":"steel-wheels/metadata.xmi", "modelDescription":"This model contains information about Employees.", "modelId":"BV_HUMAN_RESOURCES", "modelName":"Human Resources" }, { "class":"org.pentaho.common.ui.metadata.model.impl.ModelInfo", "domainId":"steel-wheels/metadata.xmi", "modelDescription":"This model contains information about products and product inventory.", "modelId":"BV_INVENTORY", "modelName":"Inventory" }, { "class":"org.pentaho.common.ui.metadata.model.impl.ModelInfo", "domainId":"steel-wheels/metadata.xmi", "modelDescription":"This model contains information about customers and their orders.", "modelId":"BV_ORDERS", "modelName":"Orders" } ] </return> </ns:listBusinessModelsJsonResponse>
loadModel
GET http://localhost:8080/pentaho/content/ws-run/metadataService/loadModel?domainId=steel-wheels%2Fmetadata.xmi&modelId=BV_ORDERS <?xml version="1.0"?> <ns:loadModelResponse xmlns:ns="http://service.metadata.ui.common.pentaho.org"> <return type="org.pentaho.common.ui.metadata.model.impl.Model"> <categories type="org.pentaho.common.ui.metadata.model.impl.Category"> <columns type="org.pentaho.common.ui.metadata.model.impl.Column"> <aggTypes>NONE</aggTypes> <category>CAT_PAYMENTS</category> <defaultAggType>NONE</defaultAggType> <description xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/> <fieldType>FACT</fieldType> <formatMask>$#,##0.00;($#,##0.00)</formatMask> <horizontalAlignment>RIGHT</horizontalAlignment> <id>BC_PAYMENTS_AMOUNT</id> <name>Amount</name> <selectedAggType>NONE</selectedAggType> <type>NUMERIC</type> </columns> ...many more <columns></columns>... <description>This category contains details about customer payments.</description> <id>CAT_PAYMENTS</id> <name>Payments</name> </categories> ...more <categories></categories>... <description>This model contains information about customers and their orders.</description> <domainId>steel-wheels/metadata.xmi</domainId> <id>BV_ORDERS</id> <name>Orders</name> </return> </ns:loadModelResponse>
loadModelJson
GET http://localhost:8080/pentaho/content/ws-run/metadataService/loadModelJson?domainId=steel-wheels%2Fmetadata.xmi&modelId=BV_ORDERS <Exception>org.apache.axis2.AxisFault: Error trying to deepSerialize at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:158) at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
...
</Exception>
doQuery
doXmlQuery
doXmlQueryToJson
doXmlQueryToCdaJson
doJsonQuery
doJsonQueryToJson
doJsonQueryToCdaJson
GWT Webservice API
This document does not describe the GWT style of the API. (Community, feel free to add this documentation).