Changes for version 0.001 - 2026-12-02
- Initial release
- WWW::MikroTik: a single Moo class for the MikroTik RouterOS REST API (https://<router>/rest), HTTP Basic auth over LWP::UserAgent
- RouterOS verbs list, add, set, remove, cmd and print, on top of the plain HTTP verbs get, put, patch, delete and post and the request core
- print takes proplist and query for the POST form of the console print (.proplist / .query)
- Values pass through as the strings RouterOS sends and expects; nothing is converted in either direction
- A response status of 300 or higher croaks with the status, message and detail of the router's JSON error object, or with the HTTP status line when there is none (non-JSON body, unreachable router, TLS error)
- A success status with a body that is not JSON croaks with the module prefix, the status line and the decoder's reason
- ua attribute as the seam for a custom or mock user agent; request logging through Log::Any
- Secret-looking fields are masked in the debug log: any top-level body key or query parameter whose name contains password, passphrase, secret, token or psk, or is key or ends in -key (private-key, pre-shared-key, auth-key, ...), except public-key; the request itself is sent unchanged
- set and remove send the id as a single path segment: the whole id is percent-encoded (UTF-8) and the leading * of an .id stays literal; the escaping keeps the id in one segment, and nothing more
- A record name that would have to be escaped - a space, a slash, a '#', a '%' - is refused by set and remove before anything is sent, with a croak that names the .id as the way to address the record: RouterOS decodes no percent-escapes in the REST path, so only the .id addresses every record
- The request path and query keys and values are character strings, encoded as UTF-8 like the JSON body: the same text gives the same URL whatever Perl's internal string representation
- build_request and parse_response: the two halves of request, for transports that send the HTTP::Request themselves (Net::Async::MikroTik); every verb returns exactly what request returns, so a subclass overriding request swaps the transport for all verbs
- a 3xx response is an error and a redirect is never followed: the default ua has max_redirect 0, so the Basic auth header is not resent to a Location
- The prerequisites are held by a test: every module the client and its tests load is named in the cpanfile, in the phase that installs it
Modules
Simple Perl client for the MikroTik RouterOS REST API