Hi Everyone,
I'm using Alfresco 5.2 Community edition. And I'm trying to do some calls using REST API.
I'm following api-explorer and so far I didn't have any problems... till now.
I would like to use REST API to get all available node fields, but cannot find a way to do this.
Is there a way to get all fields/metadata of any node object?
So I don't need fields of the specific node,I need all possible fields that can be set on any node.
Best regards,
Djordje
The Public ReST API does not provide any operation to retrieve dictionary information. This means there is no way to retrieve all properties that "can" be set on a specific node - you basically have to know them from your specific constellation of (custom) meta models. In the legacy ReST API there are operations to retrieve class / property definitions from which you can build a view of "settable" properties, but that operation is marked for "internal" use, e.g. to support Alfresco Share, and is not meant for consumption by general clients.
Thanks for quick response Axel.
No its not an option by default. However its pretty easy to create a Java backed webscript and use DictionaryService (org.alfresco.service.cmr.dictionary.DictionaryService) to extract the information you want.
Dictionary service has methods to return aspects, types and their properties.
final Map<QName, PropertyDefinition> propertiesFrmType = dictionaryService.getType(DemoContentModel.WhitePaper.TYPE).getProperties();
final Map<QName, PropertyDefinition> propertiesFrmAspect = dictionaryService.getType(DemoContentModel.Webable.ASPECT).getProperties();
Iterate the above map and prepare the response in XML, JSON etc. as you like.
You can also get details of each property by getting the property definition.
final QName propertyID = DemoContentModel.Publishable.Properties.ID;
final PropertyDefinition propDef = dictionaryService.getProperty(propertyID); // By passing the QName of a property
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.