Open ayya-vimala opened 2 months ago
Most likely what is needed here is just to call the API without expecting a response. That should automatically download things to the user's downloads folder.
Add the additional output parameter to the curl like for instance --output 'Downloads/buddhanexus-table.xlsx' \
. This can also include the actual filename and type of table requested (table or numbers). Something like this: --output 'Downloads/buddhanexus_numbers_PA_dn_1.xlsx' \
curl -X 'POST' \
'http://dharmamitra.org:8001/api-db/download/' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
--output 'Downloads/buddhanexus-table.xlsx' \
-d '{
"filename": "PA_dn_1",
"filters": {
"par_length": 30,
"score": 30,
"languages": [
"all"
],
"include_files": [
"PA_dn_2"
]
},
"page": 0,
"sort_method": "position",
"folio": "",
"download_data": "table"
}'```
Should be working now by just calling the API
Just noticed there is simply no button on the frontend for download. The button should be in the right sidebar under Options tab for the Numbers View and Table View but NOT for the Text view. Right now it erroneously shows in Text View and it downloads a file without extension. So best to make it something like filename_table.xlsx or filename_numbers.xlsx Note that the extension is xlsx
After the backend merging of #245 the backend returns a BytesIO object for download. This breaks the frontend functionality so the frontend needs to be re-setup. See the docs for the correct output link.
Care should be taken that the
download_data=''
parameter is set totable
ornumbers
depending on which view is requested for download.