Library Table of Contents Index Previous Next Comments

Chapter 4

API Demo

About the API demo  Top

The API demo shows how the API accesses the ContentDirector database to create and run a job. To view the program code for the demo, open the ContentDirector\API\SimpleAPIDemo file with a text editor.

Before you start  Top

Before you run the demo, you need to do some preliminary setup:

Environment setup

To set up the environment for the demo, complete the following steps.

Step

Action

1

For Solaris, create a /ApiDemoFiles directory, or for Windows, create C:\ApiDemoFiles.

2

Create a testfile.txt dummy text file in the directory you just created.

ContentDirector setup

To set up required database objects in ContentDirector, complete the following steps.

Note
You must access ContentDirector through the management console (standard user interface) to create these objects. For detailed instructions, see the ContentDirector 2.0 Administration Guide.

Step

Action

1

Create a user named demo with the password super, and select System Administrator for type of user.

2

Create a source called www.apidemo.com. Browse and select the ApiDemoFiles folder for the root source directory.

3

Create a destination group called filePushDemoGroup, select www.apidemo.com as the source site, and select any destinations as members of this group.

4

Ensure that ContentDirector recognizes all members of the new destination group as online and responding in the Destinations view of the main screen.

Running the API demo  Top

To run the API demo, complete the following steps.

Step

Action

1

Ensure that the ContentDirector service is running.

2

At the machine running the ContentDirector core application, navigate to the ContentDirector\API directory.

3

Run the simpleApiDemo.bat batch file.

Connecting to the database can require about a minute.

4

After the API demo runs, at the prompt, press a key to close the demo window.

Activity in the demo window  Top

As the demo runs, it executes the following steps (all printing is to the console):

Step

Action

1

Connects to the database. Prints connection status:

Connection established!

2

Retrieves the default policy and prints its name:

****************************************

Default Policy

****************************************

3

Checks whether the database is valid, and prints

****************************************

Database is valid

****************************************

4

Retrieves the list of destination groups, and finds the destination group named filePushDemoGroup.

5

Retrieves and prints the destination servers of the filePushDemoGroup destination group. Printout starts as follows:

****************************************

List of destinations for filePushDemoGroup

****************************************

6

Creates a demo job with the policy ID being the default policy ID and the content group ID being the ID of filePushDemoGroup.

7

Prints the list of jobs. Print out starts as follows:

****************************************

List of jobs

****************************************

8

Runs the new demo job.

9

Retrieves the list of jobs with the status running, and prints them out. Print out starts as follows:

****************************************

Running jobs

****************************************

10

Modifies the new demo job.

11

Prints the list of jobs. Printout starts as follows:

****************************************

List of jobs

****************************************

Activity in the ContentDirector management console  Top

The API demo creates and runs a job called ApiDemoJob. You can view this job in the Jobs view of the ContentDirector main screen. A job that ran successfully has the status of Completed. To view a history of this job, right-click the job, then click History. You can also view details in the Status window at the bottom of the main screen.

Library Table of Contents Index Previous Next Comments