DVD-Vault/Opti-Vault Application Program Interface

 

Opti-Vault has an network accessible Application Program Interface (nAPI) for querying the status of files or media stored under its control.  The nAPI is implemented via the HTTP protocol (port 80 by default) and can be invoked from any programming language that supports TCP/IP sockets or via any available web browser.

 

Server Implementation

The nAPI server is implemented as a CGI-BIN program under the web server of the system running the Opti-Vault software. 

 

Client Implementation

 

The nAPI client is any program that invokes the nAPI over the network.  Although the results of the nAPI calls are displayed by the web browser (see below), the output is structured for input to an application program.

There are two interfaces, filestat for retrieving the status of a file stored in the /cache directory (and possibly migration to the DVD library) and mediastat to retrieve the current status of media stored (or previously stored) in the DVD library.  Filestat requires an argument, the file name.

 

Web Browser Invocation

The status of a file in the OptiVault cache directory can be retrieved via a secure or non-secure HTTP request on port 80.   You can test this interface from any web browser by invoking the following URL (web link):

 

To retrieve a file status, use the following link (URL) in your browser address field:

https://server/cgi-bin/filestat?fn=test

or

https://server/cgi-bin/filestat?fn=test

 

To retrieve the media status, use the following URL:

https://server/cgi-bin/mediastat

or

http://server/cgi-bin/mediastat

 

Here is example from my test system:

PERL Invocation

#!/usr/bin/perl
use LWP::UserAgent;
$FILENAME = ‘myfile’;
$URL = 'http://server/cgi-bin/filestat?fn=$FILENAME’;
$request = new HTTP::Request('GET', "$URL");
 
The LWP modules can be retrieved from the libwww modules at a CPAN of your choice.
 
 
“C” Programming Language
 
The “C” language allows for greater control of the interface to the nAPI server.  In general the “C” program performs the following actions:
·                Create a network socket (usually with the “socket” system call under Windows or UNIX/LINUX)
·                Bind the socket to port 80 with the servers IP address with the bind routine
·                Write the request to the socket with the string “GET CGI-BIN/filestat?fn=filename” or “GET CGI-BIN/mediastat”.
·                Read the return results from the socket until the read command terminates with a 0 (or an error )
·                If you desire to use Secure Sockets, see the reference manual for the particular system you are using.
 
 
 
For more information on related C subroutines, see the CGIC project at ttp://freshmeat.net/redir/cgic/1187/url_homepage/cgic
 
In particular see the HTTP protocol RFC,
available at http://www.ietf.org/rfc/rfc2068.txt.
 
There is a program that does HTTP protocol actions at http://www.gnu.org/software/wget/wget.html
 
 
 
 
...