Determine attachment filename / filetype using HTTP REQUEST Activity


I m trying to download attachment from a API call using HTTPS REQUEST activity
I m aware that I can pass the Filename I want that gets downloaded as the attachment
But if the api can have any type of attachment in it like .eml or xlsx file, How can I mention the Filename and filetype of the attachment without knowing what it would be from api
When I tried the same with postman (with Save and Download option) I m able to download the file with its actual name and filetype
But in studio I couldn’t


Is there any way to get any type of attachments from api with its actual file name and file type


1 Like

A list of different options which can be used or combined:

  • URL Analysis
  • Response Header - Content-Type
  • Sending a Previous Call using HTTP Method: HEAD
  • Using a newer version of Http Request - and retrieving the FileName from the ILocalRessource

Can check a few options more / sometimes we can better catch info with a custom HttpClient implementation of the Call

Can u guide me with this @ppr

suggestion would be to start with HTTP/Header/Content-Disposition / Location catching

when this is fine for you. Do you have any url to run the demo against?

1 Like

I use a coupe api url
Where I’m passing url to get the attachment like this

{url}\api\attachments{attachment id}

  1. Where I m getting the attachment id from another url

  2. With the above url I get Json response but it is of junk characters. I think it is trying to parse through the attachment and give as output response and it doesn’t have any Filename or filetype

  3. With the url I use to get attachment id also doesn’t give any other details of the attachment


Hi @Palaniyappan

Content-Disposition will be a good option to find the file name.

I have tried a sample, in this content disposition is not available so used content type. (2.9 KB)

Hope this helps.


1 Like

Can you please check the following (we would like to check for a flat solution approach)

Compatibility: Windows
yellow Mark - set your URL

myResponse =

myHTTPClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, strURL))

then check in immediate panel:
is it showing the full URI with filename and extension?

Kindly note:

  • with the HEAD Request we ask for meta and are not doing the download
  • we do feel that we will enhance it

May I know what datatype u r referring for this variables



1 Like



1 Like

I couldn’t find that type even though I have imported @ppr

Are you running on legacy?

Even I don’t have an option to change the project type
It’s 2020.10.6 version
Little old

Can u pls forward me this with mail
I couldn’t open for some reason

when working with Legacy we would reference the following:

1 Like

we did run some side-by-side checks along with different scenarios and cross-checking in Postman.

For a more reliable solution, we would recommend to set up a cascade:

  • check if Content-Disposition Header is available
  • check if the request URL can be used
  • Check if the above shown Result.RequestMessage.RequestUri give details
  • Check Response.Location

It can happen, that a file name / info still cannot be determined. Then derivation from content-type or a default name can be used as alternate / fallback

Kindly note: not every content-type allows a clear derivation of the filetype / type extension

1 Like

Thanks @ppr
Appreciate ur kind help
I got it resolved with Nithin’s suggestion by getting Content Deposition where it had the Filename and filetype which I used for saving my file from api
Thanks @Nithinkrishna

Content Deposition OR content type

We keep in mind that Content Deposition is an optional header

Within the implementation we had seen:

Can you please clear what was finally used?

For a check call you could use e.g

1 Like

U r right
It’s Content-Type which has the Filename and type

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