How To Get The Redirected URL

So I have a few direct Iinks of images.

I am trying to download them but sadly the “Download File From URL” activity is not working.

I figured out the case it’s probably because the link I have it not the final destination link, it redirects to another URL.

For example, The link that I have:

https://unsplash.com/photos/7EqQ1s3wIAI/download?ixid=M3wxMjA3fDB8MXxzZWFyY2h8M3x8dHJlZXN8ZW58MHx8fHwxNzAzMzg3NzQxfDA&force&w=640

If you open the link it will take you to this final destination link:

https://images(dot)unsplash(dot)com/photo-1462143338528-eca9936a4d09?ixlib=rb-4.0.3&q=85&fm=jpg&crop=entropy&cs=srgb&w=640

So to get this final-destination-link/redirected-URL as of now I am using 2 extra activities one is browser activity to open the link I have and then get attribute activity to get the redirected URL. But as you can feel it’s not the best practice to do it and opening browser is unnecessary here.

Please help me with a better option to fetch this redirected-URL. Thanks In Advance. :slight_smile:

I tried using the HTTP request activity to directly download the image using the link that I have but it doesn’t allow me rename.

Hi @Tejaa,
I think you can make it with HTTP Request as below I did understand what do you mean with ( it doesn’t allow me rename.) however please apply below steps and update us if it works with you or you still face issue

  • Add Http Request Activity:
  • Drag and drop an Http Request activity into your workflow.
  • Configure the Activity:
  • In the properties panel of the Http Request activity, configure the following settings:
    • Set the Endpoint property to the original URL that you have (e.g., https://unsplash.com/photos/7EqQ1s3wIAI/download?ixid=M3wxMjA3fDB8MXxzZWFyY2h8M3x8dHJlZXN8ZW58MHx8fHwxNzAzMzg3NzQxfDA&force&w=640).
    • Set the Method property to GET.
    • Optionally, you can set other headers or parameters if needed.
  • Capture Redirection URL:
  • After the Http Request activity, add a Log Message activity to log the redirection URL. You can also assign the redirection URL to a variable if you want to use it further.
  • In the Log Message activity, use the following expression to capture the redirection URL from the response headers:
"Redirection URL: " + response.Headers("Location")

please try this and update us if you face issue or you still need any help :slight_smile:

1 Like

Hi,

I checked the above link and there is no redirect response. (Response code is 200)
We can get the image using HTTP Request activity with FileNameForResponseAttachment property, as the following. Can you try this?

Sample
Sample20231225-1.zip (2.8 KB)

Regards,

1 Like

Wow! You are such a saviour man! This made my workflow much faster and smooth. Thank you so much. :grinning:

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