Forum Discussion
Apr 26, 2012
Hi all, there were a couple of questions there so I'll try to hit them all.
Regarding "sessions": iControl is a stateless API. Each call is a separate HTTP connection and there is really no concept of a "user session". But, with that being said, there are some persistent variables set within the server process that live for the live of that process. They are stored on a per-user basis and are things like the current Partition and, as you've found, the recursive flag for folders. It's probably best practice, if you are having multiple applications using the same user name, to set values back to the original values after you have set them. It's not required and is really dependent on the needs of your automation. Keep in mind that you can't guarantee that changes you make will be there later (if a reboot or restart happens). I'd have your script check and set whatever values you are expecting to use during that sequence of calls.
As for the URI's, we've created our API with a separate namespace for each "interface" in our APIs. In my scripts, I've always just created multiple variables for each namespace you are accessing. ie. $LocalLBPool, $SystemSession, etc. That way when you are calling a method on that variable it's clear what interface it's going to. That's just me though. If you want to reuse the variables, then you'll have to change the namespace/url in between method calls.
-Joe