I need to call external endpoint in order to manage the responses into JS server code (timers). Both “fetch” and “XMLHttpRequest” calls seems to fail. Is it allowed to place external calls into timers server code? How can I resolve this issue?
Hello @Daniele_Di_Gregorio
Could you provide a code and an error?
XHR is Browser API, but JS Server Code is NodeJS environment. You could use a built-in tool Backendless.Request for this purpose.
Also, there additional information what would help you - link and doc
Here is a simple example:
Backendless.ServerCode.addTimer({
name: 'test',
startDate: 1642065693000,
frequency: {
schedule: 'custom',
repeat: {'every':60}
},
/**
* @param {Object} req
* @param {String} req.context Application Version Id
*/
execute(req){
return Backendless.Request.get('https://rickandmortyapi.com/api/character/39').then(result => console.log(result))
}
});
Great! Thanks a lot