Solutions

How to use the APIs as provided by Director?

Solutions ID:    KB4772
Version:    4.0
Status:    Published
Published date:    11/28/2011
Updated:    11/30/2011
 

Problem Description

I am Using the Director Application Programming Interface ( API) reference PDF guide, but I still can't get my XML file to work.

Can you give me an example of how to populate streaming video content, using this set of A.P.I.s?

Resolution

The Director APIs enable you to execute jobs using properly structured Extensible Markup Language (XML) files securely posted to a Director servlet. The parameter values you supply in the XML files follow the same rules and conventions as command line interface commands (sometimes referred to as CLI).

The following rules should be followed when using the Direcor API.

  • The XML file that executes the API must be structured as discussed in this document- More instructions can be found in the API CMG GUIDE.  
  • Blue Coat highly recommends you implement a parser—such as Simple APIfor XML (SAX) or Document Object Model ( DOM) . However, Blue Coat does not recommend a particular parser.
  • Do not use special characters in job IDs.
  • The following characters are not allowed and will result in errors if you attempt to execute jobs: +, _, ., -, $, %, &,#, and so o
  • You can name this XML file anything you want.
  • The XML must be posted to one of the following URLs:
API URL:
Content https://director_host-or-ip:8082/servlet/CommunicateServlet
SG CLI https://director_host-or-ip:8082/servlet/SGCommandServlet
Content Filitering https://director_host-or-ip:8082/servlet/PushPloicyServlet
Content Query https://director_host-or-ip:8082/servlet/ContentQueryServlet

 

Example:

1: How use the the API set to populate streaming video.

In this example, we are going to use the “Poster” Firefox plug-in with Firefox 5.0. It can create HTTP Post request and post it to the specified URL, The same thing can be done programmatically in different languages. Firefox “Poster” plug-in is available at FF POSTER:

In the below XML file, we are logging in with the mentioned credentials to the Director and sending two manifest URLs of the smooth streaming videos, called BigBuckBunny and ElephantsDream that want cached by the SGs. The Target is a group of SG appliances is  called “SGVAs”.  This is a custom group that was created using the Director Management Console ( DMC)  in advance.

<?xml version="1.0" encoding="UTF-8"?>
<API>
 <usercredential>
  <username>admin</username>
  <password></password>
  <enablepassword></enablepassword>
 </usercredential>
 <configurationlock force="true"></configurationlock>
 <smoothstreamingcontent name="sscnt1">
  <manifesturls>
   <url>http://10.125.38.254/bunny/BigBuckBunny.ism/Manifest</url>
   <url>http://10.125.38.254/elephants/ElephantsDream.ism/Manifest</url>
  </manifesturls>
 </smoothstreamingcontent>
 <target type="group">
  <group>SGVAs</group>
 </target>
</API>

Follow these steps to post this to the DIrector appliance, for Distribution:

  • Launch Firefox, and ensure that 'Poster' is installed.  If you have not yet installed this plugin, please follow the above link, and do so now.
  • Select the “Tools” menu and Click on the “Poster” menu item.
  • You should see a screen such as this one below.

 

  • Copy and paste the above XML ( or the one you are using)  to the text area presented in the “Content to Send” tab
  • Enter your own API URL in the “URL” text box of the Request panel as shown in above image.
  • Click on the post button.

Result: This will send the XML to the API,and  the manifest files will be parsed and a bunch of URLs are produced. This URL list is then pushed to the targeted SGs.

Response from Director:

  • If the XML file is acepted by Director, you should see this response from Director.

  • This response contains the Command ID, as highlighted above, and the generated URLs count each manifest URL and the status of the URL List creation. Using the command id we can query the status of pushing URL List execution (means status of pushing URLs to SGs). This is discussed later in this document.
  • If the response declares the status a failure, you will see a screenshot such as this one:

 

 

How to query for the status of a URL list execution:

To check on how many SGS now contain this content, follow these steps:

  • Launch Firefox, and ensure that 'Poster' is installed.  If you have not yet installed this plugin, please follow the above link, and do so now.
  • Select the “Tools” menu and Click on the “Poster” menu item.
  • As you did above, cut and paste the below XML file into the "Content to send" window.

<?xml version="1.0" encoding="UTF-8"?>
<API>
 <usercredential>
  <username>admin</username>
  <password></password>
  <enablepassword></enablepassword>
 </usercredential>
 <Content_Query type="summary">
  <Command_Id>1312278187977077</Command_Id>
 </Content_Query>
</API>

  • Note we have used the comand id of 1312278187977077, but yours will be different, as will the username and password.
  • Enter your own API URL in the “URL” text box of the Request panel.
  • Your screen should look something like the one below, now.

 

  • Click on the post button, and you will see a response like the one below.

  • The above output shows you how many commands were issued for device number 36-69 - 2361- and how many were succesfull- 2304- with none failing.  We have a total of 57 pending requests.

Links to other relevant articles:

More instructions for Director the director API can be found in the API CMG GUIDE

For a detailied list of CLI commands avaialble to the Director appliance, see KB4178

For a detailed explanation of how to take a backup, and send a profile, or overlay file to your SG, see KB4322


Rate this Page

Please take a moment to complete this form to help us better serve you.

Did this document help answer your question?
 
 
If you are finished providing feedback, please click the RATE CONTENT button. Otherwise, please add more detail in the following text box and then click RATE CONTENT.
 
 

Your response will be used to improve our document content.

Ask a Question