fetch
tool/fetch
Type: Command
| Argument | Type | Description |
|---|---|---|
| url | string | Full 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. |
| output | enum (none | file | user | user-with-headers) | Determines where the fetched data is stored.
Default value is |
| http-method | enum (get | post | put | delete | head | patch) | HTTP method. Default: get. |
| http-auth-scheme | enum (basic | digest) | HTTP authentication scheme. Default: basic. |
| http-data | string | POST or PUT request body data. Maximum data limit is 64 KB. |
| http-header-field | multi { 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-certificate | enum (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. |
| certificate | enum | Certificate from the certificate store used for server verification in HTTPS mode. Applicable only when check-certificate is enabled. |
| address | alt { 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-address | alt { ip: ipAddr , ip6: ip6Addr } | Source IP address for establishing the connection. Applicable to HTTP, HTTPS, and SFTP modes only. |
| port | num | Port used for the connection. |
| mode | enum (http | https | ftp | tftp | sftp) | Protocol used for the connection. When using the url parameter, the protocol is detected automatically. Default: http. |
| http-content-encoding | enum (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-type | enum (any | ipv4 | ipv6) | IP family preference when resolving domain names. Default value is any. |
| src-path | file | Path of the remote file. |
| dst-path | file | Destination path where the fetched file will be saved. |
| user | string | Username for authentication on the remote device. Default: anonymous. |
| password | string | Password for authentication on the remote device. Default: anonymous. |
| host | string | Hostname 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. |
| ascii | bool | Enables ASCII mode for FTP/TFTP transfers. Default: no. |
| upload | bool | Enables upload mode for FTP/SFTP transfers. Requires src-path and dst-path. Default: no. |
| keep-result | bool | Deprecated, use the output argument instead. |
| idle-timeout | alt { idle-timeout: time [1 .. 604800] , idle-timeout: enum (none) { none:0 } } | Idle timeout since last read/write action. Default: 10s. |
| http-max-redirect-count | num | Maximum number of HTTP redirects the fetch will follow automatically. Default: 2. |
| http-percent-encoding | bool | Percent-encodes every character in the request path except alphanumeric and -._~/?^=:. Default: no. |
| http-version | enum (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 Argument | Type | Description |
|---|---|---|
| status | enum (none | connecting | requesting | downloading | uploading | finished | failed) | Current status of the fetch operation. |
| code | num | HTTP status code returned by the server. |
| downloaded | num | Number of bytes downloaded. |
| uploaded | num | Number of bytes uploaded. |
| total | num | Total transfer size in bytes. |
| duration | time | The total duration of the fetch operation. |
| data | string | Fetched data stored in a variable when output is set to user or user-with-headers. Variable limit is 64 KB. |
| http-headers | object { http-header: super { key: string , [value] : string } } | HTTP headers returned by the server. |