Cisco Blogs


Cisco Blog > Data Center and Cloud

Cisco Unified Computing XML API with Curl and xmlstarlet

February 9, 2012 at 2:04 pm PST

One of my favorite books is The Pillars of the Earth by Ken Follet, I’ve read it and reread it many times and each time I read it I get something new out of it.  With so many good books out there it seems silly to reread a book, especially a very long book. I think what it is, is that the story is so good, the characters so compelling that I don’t want to leave them and when I’m finished with the book I miss them.  Fortunately the book was made into a mini-series that I enjoyed and brought a nice visualization of the story.  I also think the mini-series may have attracted a new set of readers in the viewing audience.

New audiences come with new methods of distribution for the same, similar or different presentation of an already published work.  With the intent to reach a new audience I am republishing a UCS XML API focused blog from another blog site on Cisco Developer Network UCS Section.  I wrote this blog in April 2010, but the methods utilized seemed to flow from my prior entries on this site.The previously published blog has references to other blogs on the on the Cisco Developer Network site in the Cisco UCS section.

The previous blog…

Last time I wrote about using telnet to connect to the UCS Manager XML API as a way to introduce the API and show it’s lack of complexity. Now I don’t expect anyone to write an application that uses telnet to manage a UCS system, I just wanted to get across that if text, XML structured text, can be pushed across an open port to the listening API process on the UCS then it doesn’t matter how the push is done.

However telnet is not very practical, so I thought I would write about curl and xmlstarlet (xmlstarlet referred to as xml in this entry). curl is used to handle the request and response cycle with the UCS and xml is used to process the XML response. In some of my early scripts I used sed and awk to “parse” the output. I say parse but it was more pattern matching; by the way sed and awk are great tools, but maybe I’m partial to them because I’ve been around for a while. The reason I started with curl, sed and awk was not because I lacked XML experience but because I wanted to appeal to the administrators out there and show that XML experience, while beneficial, is not specifically needed.

Read More »

Tags: , , , ,