Added an api wrapper that responds in json (will be used for ajax calls later)