apitest is a command-line utility to test APIs. This utility is suitable for API users who are at the beginner's level. This utility is available in C, Java, Perl, C#, VB.NET, PowerShell in Windows, Python, and Ruby. In UNIX-like environments, apitest is available in C, Java, and Perl.
For Windows, complete the following steps:
Open the command prompt.
Go to the bin\nt\ directory.
To execute, run apitest.
For a UNIX-like environment, complete the following steps:
Open the command prompt.
Go to the src/util/apitest/ directory.
Run make to create the executable.
For Windows, complete the following steps:
Open the command prompt.
Go to the src\sample\Data_ONTAP\Java\apitest\ directory.
Run MAKE.BAT file to create the class file.
For a UNIX-like environment, complete the following steps:
Open the command prompt.
Go to the src/sample/Data_ONTAP/Java/apitest/ directory.
Run make to create the class file.
Complete the following steps:
Open the command prompt.
Go to the src/sample/Data_ONTAP/Perl/ directory.
Run the perl apitest.pl command.
Complete the following steps:
Open apitest.sln located at src\sample\Data_ONTAP\DotNet\CSharp\apitest\ in Visual Studio editor.
From the Build menu, click Build apitest to generate the executable.
Complete the following steps:
Open apitest.sln located at src\sample\Data_ONTAP\DotNet\VB.NET\apitest\ in Visual Studio editor.
From the Build menu, click Build apitest to generate the executable.
Complete the following steps:
Open the PowerShell command prompt.
Go to the src\sample\Data_ONTAP\DotNet\PowerShell\ directory.
Run the .\apitest.ps1 command.
Complete the following steps:
Open the command prompt.
Go to the src/sample/Data_ONTAP/Python/ directory.
Run the python apitest.py command.
Complete the following steps:
Open the command prompt.
Go to the src/sample/Data_ONTAP/Ruby directory.
Run the ruby apitest.rb command.
The command syntax is as follows:
apitest {options} <host> <user> <password> <API> [ <paramname> <arg> ...]
|
Command details |
Description |
|
apitest |
The command name. |
|
options |
An optional parameter. See the table below for more information. |
|
host |
The host name or IP address of the server. |
|
user |
The user name. |
|
password |
The corresponding password. |
|
API |
The name of the API. |
|
paramname |
The input element of the API. |
|
arg |
The value of the input element. |
Following are the options of the apitest command:
|
Options |
Description | ||
|
-i |
API specified as XML output, on the command line. | ||
|
-I |
API specified as XML output, on standard input. | ||
|
-t |
Server type. Following are the possible values:
| ||
|
-v |
The vFiler unit name or the Vserver name, if the API has to be executed in the context of a vFiler unit or a Vserver respectively. | ||
|
-r |
Uses RPC transport.
| ||
|
-s |
Uses SSL. | ||
|
-p |
Overrides port to use. | ||
|
-x |
Shows the XML input and output. | ||
|
-X |
Shows the raw XML input and output. | ||
|
-h |
Authenticates hosts using the hosts.equiv file. | ||
|
-c |
Sets the connection timeout. |
To view more options for certificate-based authentication, see the following language-specific links:
|
Option name |
Has parameter |
Description |
|
-C |
Yes |
Name of the client certificate file to be used. |
|
-K |
Yes |
Private key file to be used. If not specified, the name of certificate file is used |
|
-P |
Yes |
Password to access the private key file |
|
-T |
Yes |
File that contains the trusted certificate that is to be used for server certificate verification |
|
-S |
No |
Enables server certificate verification |
|
-H |
No |
Enables hostname verification |
|
Option name |
Has parameter |
Description |
|
-K |
Yes |
Client keystore file to be used. |
|
-P |
Yes |
Password to access the keystore file. |
|
-E |
Yes |
Password to access the private key in the keystore file. |
|
-Y |
Yes |
Type of the keystore file (JKS/PKCS12). The default value is JKS |
|
-T |
Yes |
Truststore file to be used during server certificate verification |
|
-S |
No |
Enables server certificate verification |
|
-H |
No |
Enables hostname verification |
|
Option name |
Has parameter |
Description |
|
-C |
Yes |
Name of the client certificate file to be used. By default, the certificate is not used. |
|
-K |
Yes |
Private key file to be used. If not specified, the name of certificate file is used |
|
-P |
Yes |
Password to access the private key file |
|
-T |
Yes |
File that contains the trusted certificates that is to be used for server certificate verification |
|
-S |
No |
Enables server certificate verification |
|
-H |
No |
Enables hostname verification |
|
Option name |
Has parameter |
Description |
|
-C |
Yes |
Location of the client certificate file. |
|
-P |
Yes |
Password to access the certificate file. |
|
-T |
Yes |
Client certificate store name. The default is 'My' store. |
|
-L |
Yes |
Client certificate store location. The default is 'CurrentUser'. |
|
-N |
Yes |
Subject name of the client certificate in the certificate store. |
|
-S |
No |
Enables server certificate verification. |
|
-H |
No |
Enables hostname verification |
|
Option name |
Has parameter |
Description |
|
-C |
Yes |
Name of the client certificate file to be used. By default, the certificate is not used. |
|
-K |
Yes |
Private key file to be used. If not specified, the name of certificate file is used |
|
-T |
Yes |
File that contains the trusted certificates that is to be used for server certificate verification |
|
-S |
No |
Enables server certificate verification |
|
-H |
No |
Enables hostname verification |
|
Option name |
Has parameter |
Description |
|
-C |
Yes |
Name of the client certificate file to be used. By default, the certificate is not used. |
|
-K |
Yes |
Private key file to be used. If not specified, the name of certificate file is used |
|
-P |
Yes |
Password to access the private key file |
|
-T |
Yes |
File that contains the trusted certificate that is to be used for server certificate verification |
|
-S |
No |
Enables server certificate verification |
|
-H |
No |
Enables hostname verification |
|
|
The -v, -r, and -h options are not applicable for DataFabric Manager server. |
The following are examples of the apitest command:
Sending an API query to a storage system running Data ONTAP
|
$apitest -x <host> <user> <password> file-read-file length 100 offset 0 path /vol/vol0/etc/temp/1 INPUT: <file-read-file> <length>100</length> <offset>0</offset> <path>/vol/vol0/etc/temp/1</path> </file-read-file>
OUTPUT: <results status="passed"> <length>3</length> <data>00abcd</data> </results> |
Sending an API query to a DataFabric Manager server
|
apitest.exe -t dfm sweetpea root tryme dfm-user-priv-get <results status="passed"> <privilege>FULL</privilege> </results> |
|
|
On the Windows platform, the RPC transport layer does not work without the ntapadmin.dll file in the DLL search path of the application. The file ntapadmin.dll is at bin/nt/. |