The first step towards using NITRO is to establish a session with the NetScaler appliance and then authenticate the session by using the NetScaler administrator's credentials.
You must create an object of the com.citrix.netscaler.nitro.service.nitro_service class by specifying the NetScaler IP (NSIP) address and the protocol to connect to the appliance (HTTP or HTTPS). You then use this object and log on to the appliance by specifying the user name and the password of the NetScaler administrator.
The following sample code establishes a session with a NetScaler appliance with IP address 10.102.29.60 by using the HTTPS protocol:
//Specify the NetScaler appliance IP address and protocol nitro_service ns_session = new nitro_service("10.102.29.60","https"); //Specify the login credentials ns_session.login("admin","verysecret");
You must use the nitro_service object in all further NITRO operations on the appliance. For example to save the configurations on the appliance, you must use the nitro_service object as follows:
The nitro_service class also provides APIs to perform other system-level operations such as enabling and disabling NetScaler features and modes, saving and clearing NetScaler configurations, setting the session timeout, setting the severity of the exceptions to be handled, setting the behavior of bulk operations, and disconnecting from the appliance.