Added handler for api calls.