Hello all,
I am working on some script and I would like to have some questions sorted out about API performance and best practise. I am on R80.30 MDS and using API version 1.5.
My idea is to have opened only 1 session (via login), store session into a variable (or file) and during the entire script, working only with this one session. Means, no other sessions will be opened as I don't want to have an additional load on the machine for login and logout operations.
If I am using "-r true" for any API calls (let's say show domains), will it mean that in the background there will be a new login and logout ?
At the moment I am struggling with "show packages" for a specific domain and the fact that -s parameter isn't working.
The code looks like that:
#!/bin/bash
mgmt_cli login user "aa" password "aaaa" --format json > sid.txt
mgmt_cli show packages -d "My_Domain" -s sid.txt --format json
mgmt_cli logout -s sid.txt
rm sid.txt
And it doesn't give me the desired output - packages of the domain "My_Domain".
In case I use the following syntax, all is working fine (note -r true parameter instead of -s sid.txt):
#!/bin/bash
mgmt_cli login user "aa" password "aaaa" --format json > sid.txt
mgmt_cli show packages -d "My_Domain" -r true --format json
mgmt_cli logout -s sid.txt
rm sid.txt
But the working solution will result that I will have 2 sessions opened, right ? And I want only 1, not more.
What I am missing here ?
Thank you.
Kind regards,
Jozko Mrkvicka