So we are needing to decode / encode some strings, we have written the serverside REST web service that is only available locally to our private cloud. From the client side we need to do a GET (serverside) and then return the results to the browser.
Originally, I was using an object script trigger that did:
var url = "http://localhost:8888/XXXXX/Decode?keyString=" + mainProductKey + "&token=" + accesstoken + "&licKeyVersion=" + tcVersion;
var decoded = rbv_api.sendHttpGet(url);
Now this is all good, but the problem with firing this trigger from the client side is the call back only returns true or false whether the trigger ran successfully or not. We need to return the JSON to the browser to manipulate before creating a new record.
Is it possible to fire off server side code from the client and return the required data to the client?
As of now we don't have a client-side AJAX API that lets you call HTTP GET/POST calls from the Server side. Please add to ideas section.
You could deploy the service on same domain as Rollbase and call the service rectly from browser or if it has to different domain enable CORS and directly call the service from browser.
Else a workaround is to call create method on a dummy object where you write a pre-create trigger that gets the data and populates onto a particular field.
You can use AJAX call (jQuery) from your page. There is no need to involve Rollbase API, any web page can make HTTP call.
Needs to be executed on the server, AJAX will execute on the host machines localhost and not the servers localhost?
We can not risk exposing the web service externally so it must stay as it.
Perhaps you can store result of the call in a field, then query that field from client side.