Is there a way to delete Content Rules using Javascript API ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2013 08:22 AM
I will migrate my data to the latest version of Alfresco and at the same time, I want to delete all the Content Rules that exists in my current data tree as they will become useless.
I am able to change rights using javascripts without problems (via calls to SetPermission(), etc..), but I have not found any solution to delete a content rule. Could you please help me ?
Thank you for your help
Matthew
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2013 10:09 AM
If you want you can create your custom javascript API's to achieve this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2013 03:07 AM
I don't think I have the capabilities to build such an API… so I'll keep my useless rules contents or take time to delete them one by one.

Thanks
Matt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2013 05:42 AM
So, what I think is that if you some how manage to delete them though script rule should also be deleted. Just give it a try and let us know if it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2013 08:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2013 02:58 AM
webscript api
DELETE /alfresco/service/api/node/{store_type}/{store_id}/{id}/ruleset/rules/{rule_id}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2013 03:19 AM
that's not a problem using webscript… but as I'm not very "fluent" in Alfresco background, I don't know how to define the values between the "{..}"
Matt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2013 03:40 AM
{store_type} - that is, the type of store{store_id} - the id of the store{id} - the id of the node whose rules you want to delete{rule_id} - the id of the rule you want to delete
alfreco default store is workspace://SpacesStore ,so your url may be like this
/alfresco/service/api/node/workspace/SpacesStore/3446584b-6605-4871-8fbc-0131c6f44584/ruleset/rules/b680b35f-303b-4189-822e-4fb99b4024cc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2013 04:16 AM
OK thanks. I was successfull to list the rules first… unfortunately, this API is aimed to work on a specific node.
What I want to do is to act, starting for a node, recursively in all children nodes (deleting by hand through the web interface will not be longer than using the API)
Maybe there's a trick to display recursively all the rules ? If yes, then you mya have find the full solution

Matt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2013 05:25 AM
You can use search
GET /alfresco/service/slingshot/search
to search all node you want to deletethen iterate each node and get all rules applied to it by
/api/node/{store_type}/{store_id}/{id}/ruleset/rules?ruleType={rule_type?}
then delete each rule by
/alfresco/service/api/node/{store_type}/{store_id}/{id}/ruleset/rules/{rule_id}
