[Q&A Friday] How to Retrieve Custom Metadata with Content Automation
Now back to the question, how do you retrieve other metadata? The question was about the Android connector but it applies to content automation. The short answer: We have special headers. Here’s the definition straight from the documentation:
This header can be used whenever a document will be returned by the server. The header is forcing the server to fill the returned document up with data from schemas that match the X-NXDocumentProperties filter. So, X-NXDocumentProperties is a filter of schemas. If you don’t use the header, only the minimum amount of required document properties are returned. To have more properties in the returned document, you can specify a list of document schema names:
X-NXDocumentProperties: dublincore, file
or to have all the document content, you can use the ‘*’ character as the filter value:
If you are not familiar with Nuxeo, schemas are used to define lists of metadata.
This is intended for developers who build their own requests. If you’re using a content automation client, there’s a good chance this is already part of the client API. Here’s an example with the Java client:
import org.nuxeo.ecm.automation.client.Constants; import org.nuxeo.ecm.automation.client.adapters.DocumentService; import org.nuxeo.ecm.automation.client.model.Documents; Documents docs = (Documents) session.newRequest(DocumentService.GetDocumentChildren) .setInput(doc) .setHeader(Constants.HEADER_NX_SCHEMAS, "*").execute();