Project attachment image link expires after some time

Hi, i am wondering if anyone can help me how to get a permanent link of an image attachment or how can i increase image attachment expiration time?

Please don’t tell to save image on my server, i don’t want to store them on my server.

Thanks in advace.

Hi @Tauqeer_Abbas

I haven’t come across any expiration of Attachments that I have added to Asana.

Suggest either sharing the Error details here or contact Asana Support Directly, as per below…

Hope this help.

Jason.

1 Like

i’ve tried to access image view_url via api call, but the image link expires after some time, that what i mean

Oh okay @Tauqeer_Abbas you query is re API call, sorry didn’t realise that…

I will move this query to the API section and someone in that group should be able to assist.

Regards

Jason…

1 Like

I suggest to use the attachment.permanent_url field.

It looks like that:
https://app.asana.com/app/asana/-/get_asset?asset_id=xxx

When you call this link, asana generates and redirect to a temporary url on their AWS S3 bucket, that is active for a few minutes, that may look like this:

https://asana-user-private-us-east-1.s3.amazonaws.com/assets/xxx/yyy/zzz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=xxx&X-Amz-Date=20210707T151941Z&X-Amz-Expires=120&X-Amz-Security-Token=xxx&X-Amz-Signature=xxx&X-Amz-SignedHeaders=host#

Look at the “X-Amz-Expires=120”, I think it’s 120 minutes, or 120 secondes?

But, you can’t trust that link unless you use it immediately to start your download.

I suggest to always relaunch the “permanent_url”, that will redirect you to a new valid AWS S3 bucket link.

1 Like

i already know that permanent_url but view_url expires after 2 minutes i guess, i want to retrieve let say 20 images in a loop and then print them out, but for the same reason the images link expires…

Any help will be appreciated

The solution is to always use the permanent_url every time you start your download, and if it’s in the browser, your app will follow the redirection. Or, you need to do a “GET /attachment/xxx” every time you need to download a file, just before downloading it. There’s no other solution, the amazon link expires and there’s nothing you can do else than retrieving a new download link.

Thanks for replying frederic,

i want to give that link path to my image e.g

that doesnt work.
that expires

i cannot download the images on my server , bcz it wil use our resources, and we will get a timeout too.

Thanks for reply.

i am unable to give permanent_url to img Tag,
also view_url expires when given to img tag.

Actually there are around 50 images that i want to retrieve and show them on my page. i wanna you those external links for my images. but does not work

what is the best way i am stuck here

Hi @Tauqeer_Abbas,

There are two types of URLs of images. Let me call them #1 and #2:

  1. parmanent Asana URL: https://app.asana.com/app/asana/-/get_asset?asset_id={asset_id}
  2. temporary AWS URL: https://asana-user-private-us-east-1.s3.amazonaws.com/assets/...

When we click an image in a task, the dark background “Add feedback” window opens, and the page URL doesn’t change (it’s still the URL of the task).

I assume your screenshot is taken when you right click on the image and choose “Open Link in New Tab/Window”. The page URL is #1 at first, but then the page redirects to #2. The #2 URL has an expiration time as you reported in this topic.

What I’d propose is the same with @Frederic_Malenfant, to use the parmanent URL #1. You can see that URL on lower left in the browser when hovering over the image, and you can copy it by right-clicking the image and choosing “Copy Link Address”.
I’m using Chrome on Mac, so the UI text might vary depending on the platform.

I hope this helps!
P.S. I moved this topic from API back to Tips and Tricks.