API Delphi Client

From MikroTik Wiki
Revision as of 21:09, 1 May 2009 by Chupaka (talk | contribs) (New page: This is implementation of MikroTik RouterOS API Client for Delphi. It supports execution of parallel requests to router and has database-like interface for easy use. == Classes == '''Rou...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is implementation of MikroTik RouterOS API Client for Delphi. It supports execution of parallel requests to router and has database-like interface for easy use.

Classes

RouterOSAPI unit contains definition of two classes which you need to work with API protocol from your Delphi programs.

TRosApiClient

TRosApiResult

Examples

Creating connection to router

At first, we should declare a variable and create an instance of TRosApiClient:

var
  RouterOS: TRosApiClient;

RouterOS := TRosApiClient.Create;

Now we connect to router and perform login procedure:

if RouterOS.Connect('192.168.0.1', 'admin', 'password') then
begin
  //we are connected successfully
end
else
begin
  //an error occured; text error message is in LastError property
end;

Executing queries

All queries are done by calling Query function of TRosApiClient. It returns an instance of TRosApiResult, from which all data are fetched.

var
  Res: TRosApiResult;

Res := RouterOS.Query(['/system/resource/print'], True);

Downloads and suggestions

For downloads and suggestions see forum thread RouterOS API Delphi Client