cancel
Showing results for 
Search instead for 
Did you mean: 

Creating folder rules via API

ocox
Champ on-the-rise
Champ on-the-rise

Hi folks, I'm working on a solution using Alfresco headlessly as an ECM.  So i have the core Alfresco services but no share service.

My solution uses PDF renditions to view documents in a custom browser external to Alfresco, so depends on every document having a PDF rendition available.  As I understand it (happy for any better steers) the logical way to ensure a PDF rendition is available for each document is a webscript running as a folder rule on my documentLibrary.

The webscript itself seems fairly simple (one line,  renditionService.render(document, "{http://www.alfresco.org/model/content/1.0}pdf")).  But without share I can't work out how to apply this to my folder.  From research I understand that the current REST API cannot query or upload rules, and a deprecated REST API should be use, but I've struggled to find details.  

Any pointers appreciated on how to work with rules via REST request, or comments otherwise welcome on if this really is the best way to ensure PDF renditions are available

Thanks!!

4 REPLIES 4

kaynezhang
World-Class Innovator
World-Class Innovator

Two options come to my mind to solve this problem:
1.Develop a customized rule service web script if you want to use remote rule servcie api.
2.You can create a scheduled job in your application ,in the job call alfresco rendition rest api (https://api-explorer.alfresco.com/api-explorer/#/renditions) to create pdf rendition. I recommend this one.

mitpatoliya
Star Collaborator
Star Collaborator

There are REST APIs available out of box which will help you to manage rules.

https://docs.alfresco.com/5.0/references/RESTful-RuleRulePost.html

Additionally following tool created by Jeff pott could also be useful to you. 

https://github.com/jpotts/alfresco-rule-management

I could see that you need two step solution. 

1) Create rule which execute the renditon scripts on each content of folder.

2) Create another rule which will ensure that whenever new folder is created it will have new rule applied to it. This could be rule on your root folder of repository.

Scott_McCauley
Champ in-the-making
Champ in-the-making

@ocox Did you ever come up with a solution for this? I'm looking to do the same thing. Sady, many of the links in the replies to your post are broken and therefore don't help me.

EddieMay
World-Class Innovator
World-Class Innovator

Hi @Scott_McCauley 

I used wayback machine to access the 5.0 docs -

HTH,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!