Http request in a function node

Hi,

Apologies for the noob question if this is a simple one but I've tried a number of things and searched for something similar but I'm drawing a blank.

I am successfully accessing an online database through its API using discrete inject nodes into a HTTP Request node. I have to manually inject the respective commands in order to get the desired result. I would like to make this process simpler (more automated) and develop a custom node that handles obtaining and managing a token.

I need a way to make various https requests from within a single function node rather than use the HTTP request node. I have read about async / await calls and also promises but I don't know how to make the actual request execute from within the function. For example fetch is not supported here.

Is this possible and what is the best way to implement these asynchronous calls?

As an example a typical call using the http request node would be:-

     msg = {
        url: "https://api.glowmarkt.com/api/v0-1/virtualentity",
        method: "GET",
        headers: {
                contentype: "application/json",
                token: token,
                applicationId: applicationId},
        };
    
    return msg;
    }

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.