Chapter 4
API Demo
About the API demo
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
Before you run the demo, you need to do some preliminary setup:
- Prepare the environment for the demo to run
- Create objects in ContentDirector required by the demo
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
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
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
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.
Copyright © 1994-2001, Network Appliance, Inc. All rights
reserved.
Part No. 210-00124
File: demo.htm
Last updated: 11/12/01 14:48:21