Client Script JavaScript Fetch API availability

yt ccq
Tera Contributor

Does anyone knows what is the best method to directly access an external REST service from a Client Script ?

 

I searched for a while and found that the current method of doing that in JavaScript is to use the fetch() method.

That is the newer Promise version of the very old XMLHttpRequest JavaScript callback class.

The intent here is to access external web sites from the client scripts to get external data and do external data validations.

 

The only issue I can see is when we have to use access keys or codes to get to the expected external data.

In that case, I believe the access keys or codes do get exposed in the browser, which is really not good.

If anyone has ideas around that too, it would be great to hear about them.

 

Thank you for any insights you can provide.

1 REPLY 1

Tony Chatfield1
Kilo Patron

Hi, I would use GlideAjax to call a script-include function that manages\runs your REST query,
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.