<?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 Calling rest service via rule script in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39532#M16604</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For a project I'm working on I need to be able to upload files to an alfresco repository along with a document Id (to be stored as a value of a custom model).&lt;/P&gt;&lt;P&gt;After a file is uploaded, I want to make a call to an external rest service (that I have built) that will be able to retrieve other useful bits of metadata from a database by using the document Id provided and update the node using the public rest api.&lt;/P&gt;&lt;P&gt;I had been hoping to create a script to call this rest service using the folder rules.&lt;/P&gt;&lt;P&gt;My current approach doesn't seem to be working as I get errors when trying to upload when the rule is active, which I imagine is due to&amp;nbsp;the seemingly common "XMLHttpRequest is not defined" error (which I get when trying to run the script locally).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way I can&amp;nbsp;achieve this via this approach?&lt;/P&gt;&lt;P&gt;If not, what is the best approach to take?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Jan 2018 11:00:50 GMT</pubDate>
    <dc:creator>ally311</dc:creator>
    <dc:date>2018-01-02T11:00:50Z</dc:date>
    <item>
      <title>Calling rest service via rule script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39532#M16604</link>
      <description>Hi,For a project I'm working on I need to be able to upload files to an alfresco repository along with a document Id (to be stored as a value of a custom model).After a file is uploaded, I want to make a call to an external rest service (that I have built) that will be able to retrieve other useful</description>
      <pubDate>Tue, 02 Jan 2018 11:00:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39532#M16604</guid>
      <dc:creator>ally311</dc:creator>
      <dc:date>2018-01-02T11:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calling rest service via rule script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39533#M16605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Script which is getting executed by rule on folder, is a server side script.So the object of&amp;nbsp;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;XMLHttpRequest&lt;SPAN&gt;&amp;nbsp; will not work in that script.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;&lt;SPAN&gt;If you would like to call the rest service from that file you can follow below link for implementation of it.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;A class="link-titled" href="https://stackoverflow.com/questions/13985560/xmlhttprequest-in-rhino" title="https://stackoverflow.com/questions/13985560/xmlhttprequest-in-rhino" rel="nofollow noopener noreferrer"&gt;java - XMLHttpRequest in Rhino? - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;&lt;SPAN&gt;Another approach would be to define a policy and call&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jan 2018 17:24:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39533#M16605</guid>
      <dc:creator>krutik_jayswal</dc:creator>
      <dc:date>2018-01-05T17:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calling rest service via rule script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39534#M16606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The javascript executed by folder rules are not client side javascript, and this is why you can not make direct calls to rest APIs.&lt;/P&gt;&lt;P&gt;What you can do is to develop a custom service (java code), and then publish what you need as a Javascript root object, and then use it to call and recover the metadata you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can see how it is created by reading the following blog post&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://nathanmcminn.com/2017/04/19/a-simple-pattern-for-alfresco-extensions-2/" title="https://nathanmcminn.com/2017/04/19/a-simple-pattern-for-alfresco-extensions-2/" rel="nofollow noopener noreferrer"&gt;A Simple Pattern for Alfresco Extensions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will guide you on how to develop the integration, how to embed it into Alfresco, and then how to publish it to be used in the Javascript file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try it and let us know if you have problems&amp;nbsp;trying to follow the steps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jan 2018 17:30:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39534#M16606</guid>
      <dc:creator>douglascrp</dc:creator>
      <dc:date>2018-01-05T17:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calling rest service via rule script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39535#M16607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way to do this without having access to the Alfresco code?&lt;/P&gt;&lt;P&gt;I am using an Alfresco instance that is running externally, but I have full access to share...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jan 2018 15:41:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39535#M16607</guid>
      <dc:creator>ally311</dc:creator>
      <dc:date>2018-01-08T15:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calling rest service via rule script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39536#M16608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't need the access to "Alfresco code".&lt;/P&gt;&lt;P&gt;All you need is to use the Alfresco SDK to generate a project, create all the customizations you need (as described in the blog post I linked), package it and deploy into your Alfresco server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For information about the development process, check this series of tutorials&lt;/P&gt;&lt;P&gt;&lt;A class="jivelink11" href="https://ecmarchitect.com/alfresco-developer-series" title="https://ecmarchitect.com/alfresco-developer-series" rel="nofollow noopener noreferrer"&gt;https://ecmarchitect.com/alfresco-developer-series&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jan 2018 16:24:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39536#M16608</guid>
      <dc:creator>douglascrp</dc:creator>
      <dc:date>2018-01-08T16:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calling rest service via rule script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39537#M16609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I suppose my real question is:&lt;/P&gt;&lt;P&gt;Is there a way to do this in Alfresco already? - by any route, not necessarily scripting&lt;/P&gt;&lt;P&gt;As I don't want to patch it if I don't have to&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jan 2018 14:18:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39537#M16609</guid>
      <dc:creator>ally311</dc:creator>
      <dc:date>2018-01-12T14:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calling rest service via rule script</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39538#M16610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not that I know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2018 12:33:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/calling-rest-service-via-rule-script/m-p/39538#M16610</guid>
      <dc:creator>douglascrp</dc:creator>
      <dc:date>2018-01-15T12:33:16Z</dc:date>
    </item>
  </channel>
</rss>

