Reset fileName with RestAPI while downloading

when download file with restAPI,   I cannot rest fileName,

sample:

 my API URL  "https://server/espace/rest/download/actionName"

 then it return a binary file with name  'actionName'  without suffix

how can I reset fileName

Hi Tong,

You can use GetRequest_Submit action to get File Binary from your API. Then, you can change the name and mime type in the download action.

1. Reference GetRequest_Submit action to your project from HttpRequestHandler
2. Make your request to the URL with that action
3. After the response of GetRequest_Submit, you can assign the binary output to widget download and define your custom name.

Test 1 - I'm making a request to download an example PDF File


With best regards,
Ferhat Karatay

Ferhat Karatay wrote:

Hi Tong,

You can use GetRequest_Submit action to get File Binary from your API. Then, you can change the name and mime type in the download action.

1. Reference GetRequest_Submit action to your project from HttpRequestHandler
2. Make your request to the URL with that action
3. After the response of GetRequest_Submit, you can assign the binary output to widget download and define your custom name.

Test 1 - I'm making a request to download an example PDF File


With best regards,
Ferhat Karatay


thanks anyway,  

 'Download' Component can be used in Page Action, not in API action,

  our solution now is to reset attribute 'download' of element <a>  to add a suffix

just like 

<a href='APIURL' download='file.xlsx'>downloadWithJS</a>