02-06-2019 11:20 AM
I am trying to create an ADF component which allows users to add new aspects to a document, similar to the Manage Aspects button in Share. However, I do not find a corresponding method in the Angular class AlfrescoApi, so I guess I will have to write my own service which first fetches all available aspects for a file via REST API and later adds the chosen aspects to that file.
What is the recommended REST API endpoint for these operations?
02-07-2019 07:28 AM
Hi,
Please also note that aspects will be auto-added when you set one or more properties within the aspect.
However, if you want to have fine-grained control, for example to remove an aspect (with all it's properties) or to add a so-called "marker" aspect (hat has no properties) then you should be able to use:
Alfresco Content Services REST API Explorer
Note: if you want to add or remove aspects, then you must use GET /nodes/{nodeId} first to get the complete set of aspectNames.
I haven't had a chance to test JavaScript API (or check code) to see if you can do update "aspectNames" (via the "updateNode" API) ... please let us know if this works ?
Regards,
Jan
02-07-2019 07:28 AM
Hi,
Please also note that aspects will be auto-added when you set one or more properties within the aspect.
However, if you want to have fine-grained control, for example to remove an aspect (with all it's properties) or to add a so-called "marker" aspect (hat has no properties) then you should be able to use:
Alfresco Content Services REST API Explorer
Note: if you want to add or remove aspects, then you must use GET /nodes/{nodeId} first to get the complete set of aspectNames.
I haven't had a chance to test JavaScript API (or check code) to see if you can do update "aspectNames" (via the "updateNode" API) ... please let us know if this works ?
Regards,
Jan
02-07-2019 08:46 AM
Hi Jan, this is some great information. Thank you! I will try both approaches.
I have a follow-up question though. To enable users to pick new aspects, I will have to display all available aspects for a file in a list. Where can I retrieve the information which aspects are available for a given file?
Explore our Alfresco products with the links below. Use labels to filter content by product module.