Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to change frequency over API? #1

Open
aydogankaragoz opened this issue Feb 28, 2019 · 1 comment
Open

how to change frequency over API? #1

aydogankaragoz opened this issue Feb 28, 2019 · 1 comment

Comments

@aydogankaragoz
Copy link

Hi,

I can run following code on terminal successfully,

/interface wireless set wlan1 frequency=2412

but when I try to run over API, it gives me the following error:
MikrotikConnectionException error: no such command or directory

How can change frequency via API?

Cheers,

@danlobo
Copy link
Owner

danlobo commented Mar 1, 2019

Hello!

CLI and API have some differences syntatically wise.

The main difference is the absence of some way to set something by another property than .id, so in API you need to first get the .id of the row you want to change and after pass it as numbers property value.

Your example, inside the library, can be written as follows:

List<Map<String, String>> res = session.execute(new Command("/interface/wireless/print", 
    new CommandQueryExpression("name", CommandQueryOperation.EQUALS, "wlan1")));

Map<String, String> attrs = new HashMap<String, String>();
attrs.put("frequency", "2142");
attrs.put("numbers", res[0][".id"]);
session.execute(new Command("/interface/wireless/set", attrs));

Cheers,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants