I figured out getting username from session variable but the environment is limited on how we can build modules.
I have built one for adding alias for subdomains as well as dual delivery to alias and local mailbox.
One more constraint is, I had to create new database logins for this purpose and make seperate connection to DB in my script. Usually building apis this would be part of some common api files.
Hope this would be resolved once you have your end ready for the same