Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
jmcadams
Contributor

Session Management with the API

Jump to solution

This may have been asked before, but I can't seem to find a good example for this, my pre-apologies if I missed it. 

Is there a guide anywhere for session management with the Management API? I keep running into the issue where the object I'm working on is locked. 

My script basically:
* Login, get SID
* Do stuff (add rules / network objects)
* Publish
* Logout

However, without fail, I seem to either crash the smart console because I've left a session hanging around, or I lock an object for the next run of my script. 

Do you guys have an overall suggested strategy for handling session management? 

Thanks!!!

Joey


0 Kudos
1 Solution

Accepted Solutions
PhoneBoy
Admin
Admin
If you aren't using at least R80.20, definitely, as you can only have one active session per set of credentials in versions prior to that (if memory serves).
Even in current versions, it's generally better to utilize a separate user for API calls.

View solution in original post

4 Replies
PhoneBoy
Admin
Admin
Sounds like you're working with the API in the intended way.
Once you publish your session, that should release the lock on any changed object/rule/etc.
Logging out should invalidate your SID.

If you can reproduce this consistently, the file generated by api status -s might provide some clues.
That said, I recommend a TAC case.
0 Kudos
jmcadams
Contributor

The other thing that I haven't tried yet (I just thought about it), but might be the issue. Should I be using a different user when I'm using the API?

I'm using the same credentials for the API and the Smart Console. Is that a problem? 


0 Kudos
PhoneBoy
Admin
Admin
If you aren't using at least R80.20, definitely, as you can only have one active session per set of credentials in versions prior to that (if memory serves).
Even in current versions, it's generally better to utilize a separate user for API calls.

View solution in original post

jmcadams
Contributor

I tried it with a new user last night and that seemed to alleviate the problem. 

Thanks for the help, much appreciated!!!

0 Kudos