cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar

Downloading a file from web with header "content-disposition: attachment"

I would like to download a csv file from a webpage, however when I send the HTTP request the return is Empty(). My code is as follows:

request = New HTTP Request( URL( url), Method( "Get" ), Headers( {"Authorization: Bearer " || token} ));
data = request << send;

I receive the following response header, so I'm confident I am accessing the server: 

GetResponseHeaders = ["content-disposition" => "attachment; filename=text.csv", "content-type" => "text/csv; charset=utf-8", "date" => 06Mar2024:17:08:05, "server" => "uvicorn", "transfer-encoding" => "chunked"];

However data is Empty().  I would like to download the text.csv file, but have been unable to find a way to do so in JSL. 

 

 

1 REPLY 1
jthi
Super User

Re: Downloading a file from web with header "content-disposition: attachment"

Most likely, at least partially, depends on your endpoint. HTTP request get (file download): Operation timed out after 60000 milliseconds or maybe 

<< Download would work

jthi_0-1710241573444.png

 

 

Names Default To Here(1);

request = New HTTP Request(
	URL(
		"https://community.jmp.com/kvoqx44227/attachments/kvoqx44227/sample-data/49/1/BlueBirds.jmp"
	),
	Method("Get")
);
file = request << Download(
	"$TEMP/BlueBirds.jmp", "replace", "show progress"
);
If(!Is Empty(file),
	Open(file)
);

 

 

-Jarmo