- Language
- 🐍 Python
- Package
dojo-ros·import dojo.ros- Latest version
- 0.1.0 · 10 November 2026
- Requires
- Python ≥ 3.9
- Dependencies
- none
- License
- MIT
- Language
- 🐘 PHP
- Package
dojo/ros·Dojo\Ros- Latest version
- 0.1.0 · 10 November 2026
- Requires
- PHP ≥ 8.1
- Dependencies
ext-json *- License
- MIT
Works with: RouterOS with the binary API enabled (present since RouterOS 3.x); optional REST backend on RouterOS 7.1+. Verified on RouterOS 7.25 (API 8728, api-ssl 8729 and REST).
Independent MikroTik Dojo project library: it is not MikroTik software nor is it approved by MikroTik. Test it in a lab first.
Installation and usage
Installation (Python)
pip install --index-url https://mikrotikdojo.com/en/pypi/<your-address>/simple/ dojo-rosThe library is installed with pip from the dojo index, using a personal URL reserved for dojo members. Joining is free: you only need your email.
Usage example (Python)
from dojo.ros import Ros
with Ros("192.0.2.1", "admin", "password") as r:
print(r.identity())
res = r.resource()
print(res["board-name"], "RouterOS", res["version"])
# query + proplist
for i in r.cmd("/interface/print", "?running=true", "=.proplist=name,type"):
print(i["name"], i["type"])
# scrivere (attento all'interfaccia di gestione!)
r.cmd("/ip/address/add", address="10.0.0.1/24", interface="bridge1")
# backend REST: stessa interfaccia, basta un flag
with Ros("192.0.2.1", "admin", "password", rest=True) as r:
print(r.identity())Installation (PHP)
composer config repositories.dojo composer https://mikrotikdojo.com/en/composer/<your-address>/
composer require dojo/rosThe library is installed with Composer from the dojo repository, using a personal URL reserved for dojo members. Joining is free: you only need your email.
Usage example (PHP)
use Dojo\Ros\Ros;
$r = new Ros("192.0.2.1", "admin", "password"); // API binaria, 8728
$r->connect();
echo $r->identity(), "\n";
$res = $r->resource();
echo $res["board-name"], " RouterOS ", $res["version"], "\n";
foreach ($r->cmd("/interface/print", ["?running=true", "=.proplist=name,type"]) as $i) {
echo $i["name"], " ", $i["type"], "\n";
}
$r->close();
// backend REST: stessa interfaccia
$r = new Ros("192.0.2.1", "admin", "password", null, false, 10, true);What it does
dojo.ros talks to MikroTik routers running RouterOS through the native binary API (port 8728, or 8729 with TLS = api-ssl): the «sentence» protocol that has always been used to automate a router, present on every version and independent of the web server. It is the «parent» library of the dojo.* family.
What it does: runs any command (/interface/print, /ip/address/add…) and returns records as dictionaries; handles queries (?running=true), the .proplist, and login in both schemes (modern 6.43+ cleartext and legacy MD5 challenge-response). Ready-made shortcuts for identity, /system/resource, interfaces, addresses, routes and logs.
Two transports, one interface: the binary API by default; with a flag it switches to the REST API (/rest, RouterOS 7.1+, HTTP/JSON) without changing your code — cmd() stays identical, only the underlying transport changes.
When it helps: provisioning and automation, config backup, monitoring, dashboards, integration with other systems. Everything you would do by hand in the terminal, made repeatable.
Caution: commands are actually applied: a wrong address or firewall rule on the management interface cuts access. On the wire, the 8728 API is cleartext (credentials included): on untrusted networks use api-ssl or REST over HTTPS. No external dependencies (standard library only).
Versions
| Version | News | File |
|---|---|---|
| 0.1.0 PHP latest 10 November 2026 | First public release (PHP). Requires PHP 8.1+ (the optional REST backend also uses the curl extension). Namespace |
|
| 0.1.0 Python latest 10 November 2026 | First public release. Binary API (8728/8729) with 6.43+ and legacy challenge-response login, queries and proplist; optional REST backend ( |
Each file has its SHA-256 fingerprint (pip and Composer check it automatically) and an OpenTimestamps proof registered on Bitcoin: anyone can verify that the file is the one published on that date. Files are downloaded only if you are in the dojo.
How-tos that use it
Frequently asked questions
Does it use the binary API or REST?
Both. By default the binary API (8728/8729), which runs on every RouterOS even old and needs no web server. With rest=True it uses REST (/rest, 7.1+ only): same cmd() interface, only the transport changes. When in doubt, keep the binary (the default).
Which ports are needed?
For the binary API 8728 (cleartext) or 8729 (api-ssl, TLS); enable them in /ip/service. For REST the www (HTTP) or www-ssl (HTTPS) service.
Is it the official MikroTik API?
Yes: both the binary API and REST are official RouterOS protocols. dojo.ros is just an independent client that speaks them; it is not affiliated with MikroTik.
api-ssl won't connect: why?
With api-ssl without a certificate RouterOS offers only anonymous ciphers (ADH) that modern OpenSSL rejects. The library re-enables them by default so it can talk to a «factory» router; for strict certificate verification pass your own TLS context.
Can I write configuration, not just read it?
Yes: cmd() runs any command, including add/set/remove. Which is exactly why you should try it in the lab: a wrong command on the management interface disconnects you.