Hi!
I want to use function node to make an API call instead of use the HTTP Request node.
Is it possible?.
Regards!
Hi!
I want to use function node to make an API call instead of use the HTTP Request node.
Is it possible?.
Regards!
Yes. You will have to do everything the HTTP node already does (load a library, set up the request, method, timing parameters, setup async/await or callback etc etc etc)
But the question is why?
ok. here is the point.
I have two different http request node. The first one ask something to the API, i get the request then i go to the second http request and ask something that i need from the first api, i then get the response.
But somehow the return msg is working wrong or missing the information i need to process.
Maybe i should use a change node so i can replace the msg.payload and don't step on each other.
So preumably your first API does the authentication etc and then does a query based on a specific paramters you give it - it then returns information - which you need to parse and then feed to the 2nd query to get more detailed information.
This is a fairly common requirement
Would suggest you put a debug node on the output of the first query and show us what you get back and which information needs to be sent to the 2nd on and we can assist further.
Doing in functions nodes is just making your life much harder than it needs to be
Craig
If you want scrape data from a website behind a login then have a look at on of the puppeteer nodes.
Did for me the trick.
Just my 2 cents.
That should be the fall back IMO.
Running puppeteer/selenium is super heavy. HTTP requests are super light.
Ok, i think that is a misunderstood here.
I don't want to scrape anything.
I'm doing two request to two different API endpoints. The first endpoint returns a value and the second endpoint returns another value. The first value is being stepping (replacing) by the second and in the end i don't have the values that i need.
I think that i have to replace the msg.payload with a change node in order to avoid the issue.
After the first API call add a Change node to Move msg.payload To msg.firstData (or a better name). Then after the second one, msg.firstData should still be available.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.