QAPI Developer's Guide

Table of Contents

Overview

The Application Programming Interface (QAPI) is a Software Development Kit designed to provide programmatic interface for users to perform various operations that can be run using command line utilities or the CommCell Console. QAPI exposes C style APIs which allows users develop customized client applications, using either C or C++, for UNIX and Windows operating systems.

The following sections explain how to use QAPI to develop customized applications.

Download QAPI Programmers Library

Click here to download the header file (QAPI.h).

API Interface

QAPIs are designed in such a way that any user who is well versed with command line utilities can use the QAPIs intuitively as each command line utility is mapped one to one with QAPIs. Each QAPI takes a text string input which exactly matches the command line parameters to their corresponding command line accepts.

All QAPIs take an argument to configure the way output is displayed. Depending on the output display mode set through the output parameter, the output can be:
  • Displayed on the console.
  • Returned through a user-supplied call back function

If a user supplies a call back function, the QAPIs call the function along with a data pointer and blocks the function until it returns.

The users of these APIs are considered advanced users who are familiar with the command line parameters passed to each qcommand. Error checking and validation of command line parameters will be very limited and will not exceed what the command line framework already provides.

All qcommands can be executed as QAPIs using appropriate parameters. See the examples provided below for usage information on the following APIs:

QAPI_Init

This API takes configuration parameters needed by QAPIs. User must call this API before invoking any other API.

Syntax API_Status QAPI_Init(QAPI_InitParameters initParams);
Parameters initParams [in] Configuration parameters
Returns Command return code, 0 – Success and Non-zero – Failure, along with error description.

QAPI_Login

This API is functionally equivalent to the 'qlogin' command. It accepts the command line parameters passed to 'qlogin' and starts a new login session with the specified CommServe. This API must be called before running any other QAPIs.

Syntax QAPI_Status QAPI_Login(const char * commandString,
QAPI_Output * output);
Parameters commandString [in] Commandline parameters of 'qlogin' command
output [in,out] Output parameters
Returns Command return code, 0 – Success and Non-zero – Failure, along with error description.

QAPI_Operation

This API is functionally equivalent to the 'qoperation' command. It accepts the command line parameters passed to 'qoperation', barring a subcommand type e.g., 'backup' or 'restore'. The subcommand type is passed through the first parameter 'subcommandType'.

Syntax QAPI_Status QAPI_Operation(QAPI_OperationSubType subcommandType,
const char * commandString,
QAPI_Output * output);
Parameters subcommandType [in] Operation subcommand type
commandString [in] Commandline parameters of 'qoperation' command
output [in,out] Output parameters
Returns Command return code, 0 – Success and Non-zero – Failure, along with error description.

QAPI_Logout

This API is functionally equivalent to the 'qlogout' command. It accepts the command line parameters passed to 'qlogout' and terminates the login session created by the 'qlogin' command. Once this API is called, the user will have to call QAPI_Login in order to run more commands.

Syntax QAPI_Status QAPI_Logout(const char * commandString,
QAPI_Output * output);
Parameters commandString [in] Commandline parameters of 'qlogout' command
output [in,out] Output parameters
Returns Command return code, 0 – Success and Non-zero – Failure, along with error description.

QAPI_Exit

This API must be the last API to call and user must invoke QAPI_Init again in order to invoke more QAPIs.

Syntax QAPI_Status QAPI_Exit();
Parameters None
Returns Command return code, 0 – Success and Non-zero – Failure, along with error description.

Sample Client program

The following sample client program performs the following operations:

  • Log on to a CommServe
  • Fetches a list of configured clients
  • Displays the output on the CommCell Console

Note that this sample program is for Windows computers.