<?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 How to get repo URL from Alfresco Javascript? in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-repo-url-from-alfresco-javascript/m-p/106847#M30163</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Is there a way to receive a URL path for Alfresco &lt;STRONG&gt;repository&lt;/STRONG&gt; from JavaScript (browser console) ?&lt;/P&gt;&lt;P&gt;I know I can get easily share URL by calling:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN class=""&gt;Alfresco.constants.PROXY_URI&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;But i did not find similar node for repo url..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Aug 2019 13:17:59 GMT</pubDate>
    <dc:creator>upforsin</dc:creator>
    <dc:date>2019-08-16T13:17:59Z</dc:date>
    <item>
      <title>How to get repo URL from Alfresco Javascript?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-repo-url-from-alfresco-javascript/m-p/106847#M30163</link>
      <description>Hello,Is there a way to receive a URL path for Alfresco repository from JavaScript (browser console) ?I know I can get easily share URL by calling:Alfresco.constants.PROXY_URIBut i did not find similar node for repo url..Regards,Mike</description>
      <pubDate>Fri, 16 Aug 2019 13:17:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-repo-url-from-alfresco-javascript/m-p/106847#M30163</guid>
      <dc:creator>upforsin</dc:creator>
      <dc:date>2019-08-16T13:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to get repo URL from Alfresco Javascript?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-repo-url-from-alfresco-javascript/m-p/106848#M30164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not really sure but you can try:&amp;nbsp;Alfresco.constants.URL_SERVICECONTEXT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the purpose is to call repository webscript then you can do it using the below given approaches from share side webscript.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Call getUserInfo repository webscript.&lt;BR /&gt; var resp = remote.call("/getUserInfo"); //Call to connected alfresco repository, e.g. http://127.0.0.1:8080/alfresco/service/&lt;SPAN&gt;getUserInfo&lt;/SPAN&gt;&lt;BR /&gt; if (resp.status == 200) {&lt;BR /&gt;&amp;nbsp; var obj = JSON.parse(resp.text);&lt;BR /&gt;&amp;nbsp; model.name= obj.name;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Call the repo&amp;nbsp;&lt;BR /&gt; var conn = remote.connect("alfresco"),&lt;BR /&gt; res = conn.get("/&lt;SPAN&gt;getUserInfo&lt;/SPAN&gt;"),&lt;BR /&gt; json = JSON.parse(res);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (json.data) {&lt;BR /&gt;&amp;nbsp; model.&lt;SPAN&gt;name&amp;nbsp;&lt;/SPAN&gt;= json.data.&lt;SPAN&gt;name&lt;/SPAN&gt;;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var url = "/&lt;SPAN&gt;getUserInfo&lt;/SPAN&gt;";&lt;BR /&gt;var result = remote.connect("alfresco").get(url);&lt;BR /&gt;if (result.status == 200)&lt;BR /&gt;{&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; model.&lt;/SPAN&gt;&lt;SPAN&gt;name&amp;nbsp;&lt;/SPAN&gt;= JSON.parse(result).&lt;SPAN&gt;name&lt;/SPAN&gt;;&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Aug 2019 15:42:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-repo-url-from-alfresco-javascript/m-p/106848#M30164</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2019-08-16T15:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to get repo URL from Alfresco Javascript?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-repo-url-from-alfresco-javascript/m-p/106849#M30165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, first of all, thank you for the response. But your code doesn't work in browser console so it won't work in the Freemarker template &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My goal is to &lt;STRONG&gt;call custom repository Webscript &lt;/STRONG&gt;from control in the task-edit in the Alfresco Share.&lt;/P&gt;&lt;P&gt;I didn't want to hard-code alfresco URL ("http://localhost:8080") in the .ftl file so I though it might be a function for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, now I see that there is a &lt;STRONG&gt;much bigger problem&lt;/STRONG&gt;. Authentication in the Share in not enough for Repo. (i set up my web-script to "&amp;lt;authentication&amp;gt;user&amp;lt;/authentication&amp;gt;").&lt;/P&gt;&lt;P&gt;Do you have any idea how can I "pass authentication" from Share to Repo?&lt;/P&gt;&lt;P&gt;Right now I'm getting &lt;SPAN style="color: #ff0000;"&gt;401 Unauthorized &lt;/SPAN&gt;error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also tried using share Proxy ("&lt;A class="link-titled" href="http://localhost:8180/share/proxy/alfresco" title="http://localhost:8180/share/proxy/alfresco" rel="nofollow noopener noreferrer"&gt;http://localhost:8180/share/proxy/alfresco&lt;/A&gt;&amp;nbsp;") - no authorization problems this time but it does not always behave in the same way - it does return &lt;STRONG&gt;only a fraction of JSON&lt;/STRONG&gt; with an empty JSONArray! It happens only while using share Proxy AND while not passing any URL parameters&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT. It was an external server's fault. Alfresco Share adds additional parameter to URL (alf_ticket) and it disrupted server logic.&lt;/P&gt;&lt;P&gt;Sorry for trouble.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Aug 2019 16:28:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-repo-url-from-alfresco-javascript/m-p/106849#M30165</guid>
      <dc:creator>upforsin</dc:creator>
      <dc:date>2019-08-16T16:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to get repo URL from Alfresco Javascript?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-repo-url-from-alfresco-javascript/m-p/106850#M30166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not clear what do you mean by browser console, i might have misunderstood but the code which i shared was for share side webscript (js) which can be used to call repository side webscript.&lt;/P&gt;&lt;P&gt;Also i am not sure why using&amp;nbsp;Alfresco.constants.PROXY_URI is a problem for you to call repository custom webscript from javascript .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To call repo webscript:&amp;nbsp;Alfresco.constants.PROXY_URI can be used&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To call share webscript: Alfresco.constants.URL_PAGECONTEXT&amp;nbsp;can be&amp;nbsp;used&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Aug 2019 20:12:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-repo-url-from-alfresco-javascript/m-p/106850#M30166</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2019-08-16T20:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to get repo URL from Alfresco Javascript?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-repo-url-from-alfresco-javascript/m-p/106851#M30167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well,&lt;/P&gt;&lt;P&gt;My goal is to change Share control (like textview, editview, button etc.) in the Task-Edit page.&lt;/P&gt;&lt;P&gt;To achieve that I created custom Freemarker template. Inside, I included &amp;lt;script&amp;gt; tag from where I invoke Javascript code.&lt;/P&gt;&lt;P&gt;The code inside &amp;lt;script&amp;gt; tag behaves exactly the same as in the &lt;A href="https://mdn.mozillademos.org/files/16191/console_63.png" rel="nofollow noopener noreferrer"&gt;Browser's developer Console&lt;/A&gt; (i.e. Firefox's FireBug or Chrome's DevTools)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From your answer I understand that there is &lt;STRONG&gt;another way&lt;/STRONG&gt; to include JavaScript code. But then, how can I connect JavaScript Controller/Share side web-script to the particular control(i.e. custom text-view)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Also i am not sure why using&amp;nbsp;Alfresco.constants.PROXY_URI is a problem for you to call repository custom webscript from javascript .&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;It is no longer a problem. It was an external server's fault. My original problem has been solved &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Aug 2019 18:32:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-repo-url-from-alfresco-javascript/m-p/106851#M30167</guid>
      <dc:creator>upforsin</dc:creator>
      <dc:date>2019-08-17T18:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to get repo URL from Alfresco Javascript?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-repo-url-from-alfresco-javascript/m-p/106852#M30168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the share proxy URL of your webscripts goto &lt;A href="http://&amp;lt;&amp;gt;&amp;lt;&amp;gt;" rel="nofollow noopener noreferrer"&gt;http://&amp;lt;&amp;gt;:&amp;lt;&amp;gt;/share/service/index to find your extact url&lt;/A&gt;. All webscripts that you create on repo are also acessible from their roxy urls&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Aug 2019 05:27:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-repo-url-from-alfresco-javascript/m-p/106852#M30168</guid>
      <dc:creator>abbask01</dc:creator>
      <dc:date>2019-08-18T05:27:58Z</dc:date>
    </item>
  </channel>
</rss>

