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?
Solved! Go to Solution.
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
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
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?
Discussions, help and advice about the Alfresco Development Framework.
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.