I read many posts about this problem but I didn't found solution.
I know that
remote is not available
and I cannot use
What can I do to call REST API in rule executed script?
Please write a snippet of code.
Thank in advance.
In Rule Script, the remote object is not available. You have to manage by using available objects or have to write an action.
Document, CompanyHome, siteService etc objects are available.
var targetNode = companyhome.childByNamePath(newtargectDir);
var siteNode = siteService.getSite(site);site = siteNode.title;
Thank you but is not usefull at all.
Please tell me how to achieve calling external REST API from rule script. Either using available object or action.
What action do you mean?
Which REST API are you referring to? The Alfresco REST API or some third-party REST API?
Hi Jeff, I also have the same challenge.
I use Alfresco Community v 5.1 (f)
I do not found the required function by the link http://docs.alfresco.com/5.1/references/API-JS-WorkflowManager.html
and the link you have provided contains only the Java code and this is not for newbies like me.
I know how to create an Alfresco Share project by Alfresco SDK, but I still do not understand how to develop extensions of JS API.
So let me ask you, please tell me in couple of words (in step-by-step manner) what I need to do to start development process of JS API's extension or point me where I can find this information in yours book "Alfresco One 5x Developers Guide (Second edition)" (has been bought several days ago).
Thank you very much!
There is an example of it in the first edition of the book, but I think it got cut from the second edition. You can still get to the source code from the first edition, however, just ignore the ant-based build.
The Java that implements the Ratings Service is:
You can see it has methods for performing CRUD functions on nodes/ratings.
That service is then wrapped with this small class:
In this file, look at the bean with an id of "ratingScript".
It includes a reference to another bean called "RatingService", which in turn points to "ratingServiceImpl", both in the same file. That bean points to the Rating Service Java class implementation and "injects" the dependencies that the RatingService needs (the NodeService and the SearchService).
So the Rating Service centralizes all logic related to ratings and can be called by any Java class in Alfresco (rule actions, Java-based web scripts, Activiti task listeners, etc.).
Again, I'm linking you to this VERY OLD source code to give you an idea of how this works. Do not try to take that project and build it as it uses an old structure and an obsolete build system.
I want to call third party REST API. Flowable in my case.
Retrieving data ...