Work on api2
Update to support new api backend with SAML as well.
Minor updates to test script and cmd