Get Request API call

Could someone please help me how i can Get Request in Script Node;

I have created a Script Node where i would like to run Get Request for API,
In Bot, I do not want to create a service Node.

headers= {
‘bot-language’: ‘en’
}
fund2 = requests.get(‘http://{{url}}/api/fundData/Fund2’, headers=headers)
print(“Fund2 get:”, fund2);

Getting error {“errors”:[{“msg”:“requests is not defined”,“code”:400,“resolvedData”:{“debugLogs”:[{“botId”:"st-…

Could someone please help me in this

Hello @muhammad.afzal.exter ,

Could you clarify the reason for not wanting to use a service node? Also share the full logic implemented in script node so that we can understand the reason for error.

Hello @sameera.tumuluri

Thank you for your message, Indeed I have API where I have multiple funds, if I hit the link below

{{url}}/api/allFunds

I will get the fund list as [“Fund1”, “Fund2”, “Fund3”]
In the future, the number of funds will increase.

Now I want to loop through all Funds and Get The Fund Data from the below API
{{url}}/api/fundData/Fund1

Indeed, I want to create a loop in the script node where I would like to run the Get request for all funds.
If it is possible to get the API data in the script node instead of creating a service node.

Thank you!

Hello @muhammad.afzal.exter ,

Instead of the Script node, you can use “Bot functions” feature as explained in the earlier post:

Try it out and let us know if you face any issues.