Open Shepard199 opened 10 months ago
The intern IDs in RouterOS are all *83F
or similar. You can see the same if you do :put [/interface find]
on the router's terminal.
Example code:
TikConnection con = ConnectionFactory.OpenConnection(Type.Api, _host, _username, _password);
ITikCommand cmd = conn.CreateCommand("/interface/print", conn.CreateParameter("name", _ifName));
string id = cmd.ExecuteScalar(".id");
System.Diagnostics.Debug.WriteLine($"Interface ({_ifName}) ID: {id}");
cmd = conn.CreateCommand("/interface/remove", conn.CreateParameter(".id", id));
cmd.ExecuteNonQuery();
System.Diagnostics.Debug.WriteLine($"Interface ({_ifName}) deleted");
But since interfaces are objects with identifier names, you can delete them directly without getting the ID, like this:
TikConnection con = ConnectionFactory.OpenConnection(Type.Api, _host, _username, _password);
cmd = conn.CreateCommand("/interface/remove", conn.CreateParameter(".id", _ifName));
cmd.ExecuteNonQuery();
System.Diagnostics.Debug.WriteLine($"Interface ({_ifName}) deleted");
Hi, help me, please.For example, when I try to get the ID of any interface, I get an obscure id - (I get id - *83F, but the real id is 1198). Or how should I properly delete the interface I need?