Added support for passing api key instead of session in api calls.