NavigatorDbApi Script

 
The Navigator Db Api script is a collection of files that should be placed on your server to allow you to connect to your database using the Navigator DB API input format.
 
The Navigator Db Api script can be found in the /samples/APIs/NavigatorDbApi.zip folder included with Navigator Desktop.
 
The contents of the zip include:
 
  • NavigatorDbApi.php: This is the only file that you should need to configure, more about this below.
  • NavigatorDbApiUtils.php: Contains utilities that are used by NavigatorDbApi.php
  • adodb/ package:   The ADOdb library that allows connections to multiple database types such as MySql, MSSql, Oracle, etc.
     
The Navigator Db API has only three methods:
 
list_tables: returns 3 CSV columns containing table name, table field, field data type (for now we’re ignoring data_type). By default all tables / fields are returned, but you can explicitly specify which tables should be allowed and which table fields should be excluded. Sample output looks like this
 
Table 1, Field 1, Integer
Table 1, Field 2, String
Table 1, Field 3, String
 
get_table_data: takes a table name as a parameter, and returns a CSV file with field headers followed by the associated records. Get_table_data can also take a limit, so not too much data is returned. The call also takes an entity_type and entity_id which can be used to create a WHERE statement for that table. Sample output looks like this:
 
Field 1, Field 2, Field 3
123, “John”, “Smith”
456, “Jane”, “Doe”
 
get_version: returns the version for backward compatibility purposes.
 
These methods called from Navigator using the specified API Url such, resulting in a call such as http://server.com/NavigatorDbApi?c=get_table_data&table=Table 1