How can I download file using HTTP Request after successful login in the website

The issue is I cannot download excel file using HTTP Request.

The error message: HTTP Code Rejected:
“reason”: {
“message”: "500 - {“type”:“Buffer”,“data”…}

I have first node using HTTP Request to login into Website. (success) (Receive Payload, Message,
token, set-cookie and so on) .
When I add HTTP Request to Request URL that download excel file. It error like above.
I have follow as website, Request URL, Request Method, Response Format: File, Binary Property: data.

Based on what I know, in HTTP request Login, need to fulfill the website requirement like email and password. But second HTTP Request, in manually, I can press download button to download the file without any requirement to fulfill. However, in this situation I fulfill the Node like in the picture without any additional data. And yet still error.

If this HTTP Request using token and cookie, where I need to put the token and cookie.

Information on your n8n setup

  • n8n version:
  • Database you’re using (default: SQLite):
  • **Running n8n with the execution process :own
  • **Running n8n via desktop app

what if you change binary property to data and the URL to the full URL of the file?

and how are you passing the authentication token to this node to show its authenticated?

1 Like

@farhan_yusuf

Welcome to the community!

What @RedPacketSec said should work.

The binary data property is to give the data you are retrieving a name. So this is not what you are doing the request for.

The URL should have the file location or with an API the file name in it to retrieve that file.
(unless they are using headers or the body for example to list what file you want to retrieve)

If you have an API doc we can have a look for you to give you more detailed help.

1 Like

I have insert the full URL, and use binary property to data. But still same error.
When I use Ignore Response Code I click true, the data from previous HTTP will appear


Successful ! I just need to add Cookie in my header to authenticate the website and download the file. Thank you all!

3 Likes