Community discussions

MikroTik App
 
giox969
just joined
Topic Author
Posts: 3
Joined: Tue Oct 23, 2018 9:23 pm

Download files from RouterOS via http/https with curl/wget/browser

Mon Nov 11, 2024 8:35 pm

Hello,
I'm developing my backup script (to be run in a Linux PC, not for Mikrotik RouterOS). I'm able to create a .backup file via the /rest API, but I cannot find a way to download it to my PC.

To create a backup I use:
POST /rest/system/backup/save
BODY: {"name": "myfilename.backup"}
and it works

Then I can see the full list of file with:
GET /rest/file?type=backup
from the above list I can have the ".id" field for each file.

The problem now is: how do I download the file I created ?
I have found that
POST /file/get
HEADER {'Content-Type': 'application/json'}
BODY { ".id": "*id_of_myfilename.backup", ".proplist": "contents" }
returns a JSON object with the file contents mixed with other strings and with encoding errors :(

Is there another way to access myfilename.backup and download it with an http GET request ?
Thank you
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12530
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Download files from RouterOS via http/https with curl/wget/browser

Mon Nov 11, 2024 10:43 pm

Short:
Enable ftp and download from it
AND/OR
Send the file by internal fetch or mail.
 
giox969
just joined
Topic Author
Posts: 3
Joined: Tue Oct 23, 2018 9:23 pm

Re: Download files from RouterOS via http/https with curl/wget/browser

Tue Nov 12, 2024 11:43 am

Thank you for the hint.

FTP is disabled by default, but scp works by default without problems:
scp admin@routerip:/filename.backup .
Thank you again.

Who is online

Users browsing this forum: WarlorZ and 10 guests