Restructured the test-API script to have a main() and accept arguments
for username,password, domain, port and secure port