What is the best way to call a REST API?

Hello,
Is it possible to call REST API (in my case provided by my wordpress website)?

I have explored the httpGet method but I see it is only available in the script, and do not really get how it works… is it possible to have the API call been performed in the custom module?

thanks

The only way I see is using a custom module where you can load native node modules and do pretty much anything you want. Since the custom module can catch outgoing message you can sort of bind the widgets with REST calls here.

Great indeed!
So I can use another javascript to fetch a json and then use it for the session within the custom module

Thanks for the tips

For the record, a barebone example:

const https = nativeRequire('https')

function get(url, callback){

    https.get(url, (resp) => {

        let data = '';

        resp.on('data', (chunk) => {
            data += chunk;
        });

        resp.on('end', () => {
            callback(data)
        });

    }).on("error", (err) => {
        console.log("REST Error: " + err.message);
    });

}


module.exports = {

    oscOutFilter:function(data){
        // Filter outgoing osc messages

        var {address, args, host, port, clientId} = data

        if (address === '/rest') {

            // use 1st arg as request url
            get(args[0].value, (data)=>{
                console.log('REST response')
                console.log(data)
                // do something with the response ?
            })

        }

        // return data if you want the message to be and sent
        return {address, args, host, port}

    }


}