Skip to main content
Version: current

fetch


tool/fetch

Type: Command

ArgumentTypeDescription
urlstringFull URL of the resource. Can replace the separate address and src-path parameters. Supports VRF designation by appending @vrf_name to the IP in the URL.
outputenum (none | file | user | user-with-headers)

Determines where the fetched data is stored.

  • none - do not store downloaded data.
  • file - store downloaded data in a file.
  • user - store downloaded data in the data variable (limit 64 KB).
  • user-with-headers - store downloaded data and headers in the data variable (limit 64 KB, 20 KB for data, 44 KB for headers).

Default value is file.

http-methodenum (get | post | put | delete | head | patch)HTTP method. Default: get.
http-auth-schemeenum (basic | digest)HTTP authentication scheme. Default: basic.
http-datastringPOST or PUT request body data. Maximum data limit is 64 KB.
http-header-fieldmulti { array-id, header-field: string }HTTP header fields and values, in the form of "h1:fff,h2:yyy". Within a single header, multiple values are escaped with two backslashes, e.g. "h:fff\,yyy".
check-certificateenum (no | yes | yes-without-crl)TLS certificate validation. yes - validates the trust chain against the local certificate store. yes-without-crl - validates the certificate without performing a CRL check. Default: no.
certificateenumCertificate from the certificate store used for server verification in HTTPS mode. Applicable only when check-certificate is enabled.
addressalt { address: address (flags=46vi) , address: ipAddr }IP address of the target device. Append @vrf_name to run the fetch operation within a specific VRF, or omit the address and supply only the VRF when using the url parameter.
src-addressalt { ip: ipAddr , ip6: ip6Addr }Source IP address for establishing the connection. Applicable to HTTP, HTTPS, and SFTP modes only.
portnumPort used for the connection.
modeenum (http | https | ftp | tftp | sftp)Protocol used for the connection. When using the url parameter, the protocol is detected automatically. Default: http.
http-content-encodingenum (deflate | gzip)Encodes the payload using gzip or deflate compression and adds a corresponding Content-Encoding header. Only applicable to POST and PUT methods.
ip-typeenum (any | ipv4 | ipv6)IP family preference when resolving domain names. Default value is any.
src-pathfilePath of the remote file.
dst-pathfileDestination path where the fetched file will be saved.
userstringUsername for authentication on the remote device. Default: anonymous.
passwordstringPassword for authentication on the remote device. Default: anonymous.
hoststringHostname or virtual hostname of the remote web server. Useful when the same IP serves multiple virtual hosts. For example, address=manual.mikrotik.com host=forum.mikrotik.com.
asciiboolEnables ASCII mode for FTP/TFTP transfers. Default: no.
uploadboolEnables upload mode for FTP/SFTP transfers. Requires src-path and dst-path. Default: no.
keep-resultboolDeprecated, use the output argument instead.
idle-timeoutalt { idle-timeout: time [1 .. 604800] , idle-timeout: enum (none) { none:0 } }Idle timeout since last read/write action. Default: 10s.
http-max-redirect-countnumMaximum number of HTTP redirects the fetch will follow automatically. Default: 2.
http-percent-encodingboolPercent-encodes every character in the request path except alphanumeric and -._~/?^=:. Default: no.
http-versionenum (http1_1 | http2 | http2-forced)HTTP protocol version. HTTP2 is supported only on ARM64 and x86/CHR devices. Default value is http1_1.
Read-only ArgumentTypeDescription
statusenum (none | connecting | requesting | downloading | uploading | finished | failed)Current status of the fetch operation.
codenumHTTP status code returned by the server.
downloadednumNumber of bytes downloaded.
uploadednumNumber of bytes uploaded.
totalnumTotal transfer size in bytes.
durationtimeThe total duration of the fetch operation.
datastringFetched data stored in a variable when output is set to user or user-with-headers. Variable limit is 64 KB.
http-headersobject { http-header: super { key: string , [value] : string } }HTTP headers returned by the server.