Sunday, March 13, 2011

Easter Egg for Zend/PHP Developers

One among many new interesting Zend Server 5.1 features is an open "RESTful Web API that allows automation of the management and deployment of Zend Server and Zend Server Cluster Manager, and integration with other Zend or 3rd party software". It basically provides an easy way to control your deployment of Web Servers remotely and set it up correctly for your application when you scale up and down. For example one can remotely configure new Web application server, reset or even build a fully functional cluster by utilizing this new open API.

Since most of the configuration and deployment tools these days have a Java-based plugins mechanism (such as Jenkins / Eclipse) I thought it would be cool if there will be a way to extend these tools with some of the new Web API features. I am proud to introduce Zend WebAPI project that is hosted in Google Code. Zend Web API SDK for Java provides a Java API for Zend Server infrastructure services, making it even easier for developers to build applications that tap into the scalable, and reliable Zend Server product.

You can find a getting started page that explains how to work with this library. This tutorial is based on the following steps:
1. Signing up for Zend Web API Services
2. Getting your Zend Web API Security Credentials
3. View Your Zend Web API Security Credentials
4. Using the Zend Web API SDK for Java
5. To run a sample you can use this code:

/**
* Create the credential object
*/
WebApiCredentials credentials = new BasicCredentials(KEY_NAME, SECRET_KEY);

/**
* Creates the Web API client object
*/
final WebApiClient webApiClient = new WebApiClient(credentials, HOST);

/**
* Retrieve system info
*/
SystemInfo systemInfo = webApiClient.getSystemInfo();

/**
* Print license info from retrieved system info
*/
System.out.println("License order number:" + systemInfo.getLicenseInfo().getOrderNumber());


I am really anxious to see what tools we will built on top of these open API that can make a difference in the world of high availability demand from the market.

Thanks to Shahar Evron (@shevron) who has guided me through the API aspects!

If you find this useful I would be happy to get some feedback and even new contribution!

As an example for utilizing this library I created an Eclipse plugin that is used as a "remote controller" for your Zend Server

For more details click here