Code moved in api directory, use of api_tokens and users tables, running all queries using openemr sql wrappers.