mikrotikrouter-os

How use "import" in mikrotik routeros api?


I can connect to mikrotik device via serial port and use command: "/import getID.rsc". How call "/import getID.rsc" via routeros api http api (http://wiki.mikrotik.com/wiki/API) ?


Solution

  • API in RouterOS closely resembles CLI and to get details of some CLI command you have to press '?' to get more details.

    For example, here is the help output for import command:

    [admin@MikroTik] > import 
    
    <file-name> -- The name of the file you want to import
    from-line -- 
    verbose -- 
    

    variable name in <> is one that can be omitted in CLI. In API you have to give that variable name to set value.

    So resulting API command looks like this:

    /import
    =file-name=test.rsc