<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to call REST API of remote service in rule executed script in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14210#M6248</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;I want to call third party REST API. Flowable in my case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Sep 2017 14:02:52 GMT</pubDate>
    <dc:creator>pnature</dc:creator>
    <dc:date>2017-09-05T14:02:52Z</dc:date>
    <item>
      <title>How to call REST API of remote service in rule executed script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14202#M6240</link>
      <description>Hi,I read many posts about this problem but I didn't found solution.I know thatremote is not availableand I cannot useXMLHttpRequest()What can I do to call REST API in rule executed script?Please write a snippet of code.Thank in advance.</description>
      <pubDate>Thu, 17 Aug 2017 10:41:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14202#M6240</guid>
      <dc:creator>pnature</dc:creator>
      <dc:date>2017-08-17T10:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to call REST API of remote service in rule executed script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14203#M6241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In Rule Script, the remote object is not available. You have to manage by using available objects or have to write an action.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Document, CompanyHome, siteService etc objects are available.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;document.save();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var targetNode = companyhome.childByNamePath(newtargectDir);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var siteNode = siteService.getSite(site);&lt;BR /&gt;site = siteNode.title;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2017 11:14:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14203#M6241</guid>
      <dc:creator>ratik_singhal</dc:creator>
      <dc:date>2017-08-17T11:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to call REST API of remote service in rule executed script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14204#M6242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you but is not usefull at all.&lt;/P&gt;&lt;P&gt;Please tell me how to achieve calling external REST API from rule script. Either using available object or action.&lt;/P&gt;&lt;P&gt;What action do you mean?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2017 12:44:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14204#M6242</guid>
      <dc:creator>pnature</dc:creator>
      <dc:date>2017-08-17T12:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to call REST API of remote service in rule executed script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14205#M6243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Which REST API are you referring to? The Alfresco REST API or some third-party REST API?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2017 19:26:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14205#M6243</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2017-08-18T19:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to call REST API of remote service in rule executed script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14206#M6244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeff, I also have the same challenge.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example I want to call the following RESTful API from a rule JavaScript file, how I can do that ? :&lt;/P&gt;&lt;P&gt;&lt;A class="jivelink10" href="http://192.168.0.134:8080/alfresco/service/api/workflow-instances" title="http://192.168.0.134:8080/alfresco/service/api/workflow-instances" rel="nofollow noopener noreferrer"&gt;http://localhost:8080/alfresco/service/api/workflow-instances&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use Alfresco Community v 5.1 (f)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2017 11:54:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14206#M6244</guid>
      <dc:creator>egor</dc:creator>
      <dc:date>2017-08-24T11:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to call REST API of remote service in rule executed script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14207#M6245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you are running code in the repository tier (in the alfresco.war) and you feel like you need to call a web script from JavaScript, you should first ask yourself if there is a native API call that will get you what you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, you want to get the workflow instances, which is available natively in the JavaScript API, see&amp;nbsp;&lt;A class="link-titled" href="http://docs.alfresco.com/5.1/references/API-JS-WorkflowManager.html" title="http://docs.alfresco.com/5.1/references/API-JS-WorkflowManager.html" rel="nofollow noopener noreferrer"&gt;http://docs.alfresco.com/5.1/references/API-JS-WorkflowManager.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that doesn't get you what you need you can write a Java class that uses the native Java API which can surely meet your needs. You can then use either a Java-backed web script to use that class or you can wrap the Java class with a BaseScopableProcessorExtension so that it is available as a root scoped JavaScript object. There are lots of examples of how to do that, but &lt;A href="http://spalyukh.blogspot.com/2015/09/custom-root-scope-object-js-api-service.html" rel="nofollow noopener noreferrer"&gt;here's one&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2017 13:46:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14207#M6245</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2017-08-24T13:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to call REST API of remote service in rule executed script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14208#M6246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jeff,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not found the required function by the link &lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://docs.alfresco.com/5.1/references/API-JS-WorkflowManager.html" rel="nofollow noopener noreferrer" style="color: #1e88e5; background-color: #ffffff; border: 0px; text-decoration: none; padding: 0px calc(12px + 0.35ex) 0px 0px;" target="_blank"&gt;http://docs.alfresco.com/5.1/references/API-JS-WorkflowManager.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and the &lt;A href="http://spalyukh.blogspot.com/2015/09/custom-root-scope-object-js-api-service.html" rel="nofollow noopener noreferrer"&gt;link&lt;/A&gt; you have provided contains only the Java code and this is not for newbies like me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know how to create an Alfresco Share project by Alfresco SDK, but I still do not understand how&amp;nbsp;to develop extensions of JS API.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So let me ask you, please tell&amp;nbsp;me in&amp;nbsp;couple of words (in step-by-step manner) what I need to do to&amp;nbsp;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&amp;nbsp;bought several days&amp;nbsp;ago).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Egor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Aug 2017 04:48:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14208#M6246</guid>
      <dc:creator>egor</dc:creator>
      <dc:date>2017-08-25T04:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to call REST API of remote service in rule executed script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14209#M6247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Extending the server-side JavaScript engine by adding your own root-scoped objects will require Java.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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&amp;nbsp;ignore the ant-based build.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example in the book consolidates the "rating" logic into a common service class, then wraps that class to make the rating service available from JavaScript.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;&lt;STRONG style="font-size: 15px;"&gt;Rating Service:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;The Java that implements the Ratings Service is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;A href="https://github.com/jpotts/alfresco-developer-guide/blob/master/client-extensions/src/java/com/someco/service/RatingServiceImpl.java" rel="nofollow noopener noreferrer"&gt;https://github.com/jpotts/alfresco-developer-guide/blob/master/client-extensions/src/java/com/someco/service/RatingServiceImpl.java&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;You can see it has methods for performing CRUD functions on nodes/ratings.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 15px;"&gt;JScript wrapper:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;That service is then wrapped with this small class:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;A href="https://github.com/jpotts/alfresco-developer-guide/blob/master/client-extensions/src/java/com/someco/jscript/Ratings.java" rel="nofollow noopener noreferrer"&gt;https://github.com/jpotts/alfresco-developer-guide/blob/master/client-extensions/src/java/com/someco/jscript/Ratings.java&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;That class basically defines the API that will be exposed to JavaScript.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 15px;"&gt;Spring Config:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;In this file, look at the bean with an id of "ratingScript".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;A href="https://github.com/jpotts/alfresco-developer-guide/blob/master/client-extensions/config/alfresco/extension/someco-services-context.xml" rel="nofollow noopener noreferrer"&gt;https://github.com/jpotts/alfresco-developer-guide/blob/master/client-extensions/config/alfresco/extension/someco-services-context.xml&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;That tells Alfresco, "Here is a new object to expose to the JavaScript engine".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;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).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 15px;"&gt;Summary:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;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.).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Then, the JScript wrapper exposes the same service to the JavaScript engine making the same logic available to things like the JavaScript console, JavaScript-based web scripts, or Activiti in-line JavaScript code blocks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case, if the out-of-the-box workflow object does not meet your requirements, you'll have to use the Java API. Probably the best approach is to write a small service class, like I've done here, that uses the Java API to get information from workflows, then you'll write a wrapper to expose that service to JavaScript.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Aug 2017 14:03:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14209#M6247</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2017-08-25T14:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to call REST API of remote service in rule executed script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14210#M6248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;I want to call third party REST API. Flowable in my case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Sep 2017 14:02:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14210#M6248</guid>
      <dc:creator>pnature</dc:creator>
      <dc:date>2017-09-05T14:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to call REST API of remote service in rule executed script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14211#M6249</link>
      <description>&lt;P&gt;Hi pnature,&lt;/P&gt;&lt;P&gt;Were you able to resolve and call a REST API from JavaScript Console.&lt;/P&gt;&lt;P&gt;Could you please share the steps.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2024 11:53:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14211#M6249</guid>
      <dc:creator>saikiran_vsk</dc:creator>
      <dc:date>2024-06-03T11:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to call REST API of remote service in rule executed script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14212#M6250</link>
      <description>&lt;P&gt;You can not directly call third party api from script.&lt;/P&gt;&lt;P&gt;You can create custom root object usign java and in java you can write code to call rest api.&lt;/P&gt;&lt;P&gt;&lt;A href="https://spalyukh.blogspot.com/2015/09/custom-root-scope-object-js-api-service.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://spalyukh.blogspot.com/2015/09/custom-root-scope-object-js-api-service.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 11:28:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-call-rest-api-of-remote-service-in-rule-executed-script/m-p/14212#M6250</guid>
      <dc:creator>sp2</dc:creator>
      <dc:date>2024-06-04T11:28:52Z</dc:date>
    </item>
  </channel>
</rss>

