C H A P T E R  12

Vending Manager API

The Vending Manager API provides access to Vending Manager data maintained by Content Delivery Server. Use this API to create and manage bundles, campaigns, subscriber segments, and subscriber plans without going through the Vending Manager administration console interface.

The Vending Manager API is accessed through an XML-RPC (remote procedure call) implementation. XML-RPC enables your application to make remote procedure calls using HTTP for the transport and XML for data encoding. You can use XML-RPC with many different programming languages by using bindings that are available on the Internet.



Note - A tutorial on XML-RPC is beyond the scope of this document. Information on writing applications that use XML-RPC is available from various web sites on the Internet.


The Vending Manager API includes the following classes:

For information on these classes and their methods and parameters, see the HTML output of the Javadoc tool at $CDS_HOME/javadoc/vendingapi/index.html.


12.1 General Process Flow

The Vending Manager API provides access to Vending Manager data, therefore, the first step in any application that uses this API must be to log in to the Vending Manager using the AuthenticationHandler.logUserIn method. The user name that is used to log in must be a valid Vending Manager administrator account, not a Customer Care Agent.



Note - The password for the account used cannot be the default password admin. If it is, you must log in to the Vending Manager administration console and change the password before the application is run.


If the login is successful, an authorization key is returned. Use this authorization key in all subsequent calls for Vending Manager data. When the application completes all tasks, the final step is to log out of the Vending Manager using the AuthenticationHandler.logUserOut method.



Note - If an authorization key is not used for a set number of minutes, the key expires and calls after that time fail. The application must log in again to receive a new authorization key. The default period is 10 minutes. To change the period, set the vendingApi.authkey.timeout.minutes in the $CDS_HOME/deployment/deployment-name/conf/VSAdminConsole.properties file.



12.2 Guidelines for Calls to XML-RPC Methods

XML-RPC calls follow certain conventions. The sample code in this section illustrates how to make the call and process the results for authenticating a user. The sample code is written in the Java programming language and uses the Apache XML-RPC client library. The code that you need to write might differ if you are using a different language or library.



Tip - See the output of the Javadoc tool at $CDS_HOME/javadoc/vendingapi/index.html for the names of the methods and the parameter keys for each handler.


Use the following guidelines to code your calls to the handlers:

A complete example of processing a request to log in to the Vending Manager is available through the Open Content Delivery Server project at https://opencds.dev.java.net/source/browse/opencds/trunk/modules/contrib/vendingjavaclient/src/example/com/sun/content/server/vendingjavaclient/xmlrpc/LoginExample.java. The example is for illustration purposes only and is not supported.


12.3 Accessing Content Delivery Server

To obtain data from Content Delivery Server, your application must be able to communicate with Content Delivery Server. Work with your network administrator to ensure that the application can contact Content Delivery Server and that any required proxy or firewall is configured to allow this access.

In addition, Content Delivery Server must recognize that your client is authorized to make requests for data. The vendingApi.xml-rpc.trustedHosts property in the $CDS_HOME/deployment/deployment-name/conf/VSAdminConsole.properties file contains the list of hosts from which requests are accepted.

Set the vendingApi.xml-rpc.trustedHosts property to the host name or IP address of the host on which your application is located, whether it is on the same host as Content Delivery Server or on a different host. To accept requests from any host, leave the value blank. To accept requests from more than one host, separate the host names or IP addresses with a comma, for example:

vendingApi.xml-rpc.trustedHosts=127.0.0.1,localhost