<?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>question Client Script JavaScript Fetch API availability in ServiceNow AI Platform forum</title>
    <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/client-script-javascript-fetch-api-availability/m-p/2532937#M189086</link>
    <description>&lt;P&gt;Does anyone knows what is the best method to directly access an external REST service from a Client Script ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I searched for a while and found that the current method of doing that in JavaScript is to use the &lt;STRONG&gt;fetch()&lt;/STRONG&gt; method.&lt;/P&gt;&lt;P&gt;That is the newer &lt;STRONG&gt;Promise&lt;/STRONG&gt; version of the very old&amp;nbsp;XMLHttpRequest JavaScript callback class.&lt;/P&gt;&lt;P&gt;The intent here is to access external web sites from the client scripts to get external data and do external data validations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only issue I can see is when we have to use access keys or codes to get to the expected external data.&lt;/P&gt;&lt;P&gt;In that case, I believe the&amp;nbsp;access keys or codes do get exposed in the browser, which is really not good.&lt;/P&gt;&lt;P&gt;If anyone has ideas around that too, it would be great to hear about them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any insights you can provide.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Apr 2023 21:33:22 GMT</pubDate>
    <dc:creator>yt ccq</dc:creator>
    <dc:date>2023-04-12T21:33:22Z</dc:date>
    <item>
      <title>Client Script JavaScript Fetch API availability</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/client-script-javascript-fetch-api-availability/m-p/2532937#M189086</link>
      <description>&lt;P&gt;Does anyone knows what is the best method to directly access an external REST service from a Client Script ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I searched for a while and found that the current method of doing that in JavaScript is to use the &lt;STRONG&gt;fetch()&lt;/STRONG&gt; method.&lt;/P&gt;&lt;P&gt;That is the newer &lt;STRONG&gt;Promise&lt;/STRONG&gt; version of the very old&amp;nbsp;XMLHttpRequest JavaScript callback class.&lt;/P&gt;&lt;P&gt;The intent here is to access external web sites from the client scripts to get external data and do external data validations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only issue I can see is when we have to use access keys or codes to get to the expected external data.&lt;/P&gt;&lt;P&gt;In that case, I believe the&amp;nbsp;access keys or codes do get exposed in the browser, which is really not good.&lt;/P&gt;&lt;P&gt;If anyone has ideas around that too, it would be great to hear about them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any insights you can provide.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 21:33:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/client-script-javascript-fetch-api-availability/m-p/2532937#M189086</guid>
      <dc:creator>yt ccq</dc:creator>
      <dc:date>2023-04-12T21:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Client Script JavaScript Fetch API availability</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/client-script-javascript-fetch-api-availability/m-p/2534266#M189108</link>
      <description>&lt;P&gt;Hi, I would use GlideAjax to call a script-include function that manages\runs your REST query,&lt;BR /&gt;but any suspect the solution could result in a slow\poor user experience, so if possible ensure you build in a way that doesn't have the user waiting for a response.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 22:21:04 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/client-script-javascript-fetch-api-availability/m-p/2534266#M189108</guid>
      <dc:creator>Tony Chatfield1</dc:creator>
      <dc:date>2023-04-13T22:21:04Z</dc:date>
    </item>
  </channel>
</rss>

