Question

Change filename when saving files from HTTPcaller


Hi

 

I'm trying to download data from Ordnance Survey using their API. I've got this working successfully but the downloaded files do not have their correct filenames.

 

I've used JSONfragmenter to create a column called "url" for the download location and another called "fileName" for the filename. Can anyone help explain how I can rename the downloads with the name from fileName please?

 

Thanks

Rob


4 replies

Userlevel 3
Badge +16

Have the HTTPCaller save the response body to file, and set the output filename to be that attribute:

image 

The other way you could do it is on the HTTPCaller save the response body to an attribute, then use an AttributeFileWriter to write out that attribute to a file. And again, the filename there can be set to be an attribute value.

Many thanks for your help :). My dialog box looks slightly different to that (I think I'm using a slightly out-of-date version: 2021.2). I've got it to save using the filename, as below, but is there a way to specify the path that it save to as well as the filename?

 

Screenshot 2022-06-13 082035Many thanks

Rob

Userlevel 3
Badge +16

I'm on a slightly older version, 2021.1. Surprised it's different. If you use the [...] button to create a file in typical fashion, you'll see that it's actually expecting a full filepath, not just a filename.

image

I'm on a slightly older version, 2021.1. Surprised it's different. If you use the [...] button to create a file in typical fashion, you'll see that it's actually expecting a full filepath, not just a filename.

image

Thanks, that makes sense. And to combine the folder with the value in the fileName column I've used E:\\downloads\\@Value(fileName), which works perfectly! :)

 

Thanks so much for your help.

Rob

Reply