38
Views
2
Comments
Get content from URLs
Question

Hi All,

I am getting list of URLs by calling a REST Service. I need to retrieve the file contents from this URL. When we visit this URL, a file gets automatically downloaded and we can see the file content. So I need only the file content. After calling the 1st REST service in the flow to retrieve the URLS, What should I add in the flow  to visit the URL and get the file content. How we can do this implementation.



Thanks,

Lincy 

2024-09-12 02-43-38
Deepsagar Dubey

Hi @Lincy Thomson 

I don't know your exact business flow but as you mention in comment according to that you can follow these 3 options -

Option 1 -

If you want to load file data on click of URL received from 1st API and displaying on Interface then call it on real time, You can customise  the endpoint/base URL in OnBeforeRequest action. as shown in below SS.

 

Option 2 -

If you don't want to get File data just after the first API call then you can save the response in an entity along with one extra attribute (i.e. IsGetURLContent) and set it False by default, then you can create a Timer and schedule it according to your need and call the 2nd API one by one and save binary data in an separate entity, 

Option 3 -

If you need File Data just after your first API call finished then create a process and set launch property to create action of your entity where you are saving 1st API response,

Then inside process create an automatic activity and inside action call 2nd API, 

Its an asynchronous process and will runs in background, number of threads depends on your front end servers by default it has 10 threads.

I hope it'll help you.

Thanks
Deep 

2024-07-12 05-57-50
Gourav Shrivastava
Champion

@Lincy Thomson 

To retrieve file contents after calling the initial REST service, follow these steps:

  1. Loop Through URLs: Use a For Each loop to iterate through the list of URLs returned by the first REST service.

  2. HTTP Client: Inside the loop, use the GetRequest_Submit action from HTTPRequestHandler module.  pass the URL of the file and add "" in arguments it will return the binary content


Please take reference from the OML file 


Thanks 

Regards 

Gourav Shrivastava


getfilbyURL.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.