Citrix


Netscaler NITRO API 101: Logging in with Python

UPDATE: 28/09/2011 – I have resolved the issues I was having with the Citrix blogging system and published an updated version of this post there:

Netscaler NITRO API 101: Logging in with Python

I’ll hopefully be an actual Citrix blogger soon, but in order to try this out, I thought I would post here first and see how it goes…..

If you are using one of the SDKs (Java or C#) then creating a NITRO session on the Netscaler is as simple as creating a new “nitro_service” object, choosing your connection method and setting your credentials appropriately. If have supplied valid credentials and your Netscaler is correctly configured then you can continue on your merry way and remain ignorant of what has just happened in the background. However, if you are looking to use another language to make use of the RESTful interface that NITRO provides, then you will need to know more.

The NITRO API Documentation is available from the Netscaler GUI, of course, but that serves as more of a functional specification than a guide to building a successful REST client in your language of choice. So, what exactly is required to take that first step and log in to a Netscaler?

The short answer is: A properly formatted POST request using appropriate credentials – easy, right?

Creating that properly formatted request, from scratch, can be more tricky that it appears. The exact requirements, along with an example, are after the break.