public function getApi()
    {
        if ($this->app['debug']){
            $exceptionLogStr = 
                'Ext.direct.Manager.on("exception", function(error){console.error(Ext.util.Format.format("Remote Call: {0}.{1}\n{2}", error.action, error.method, error.message, error.where)); return false;});';            
        }else {
            $exceptionLogStr = 
                sprintf('Ext.direct.Manager.on("exception", function(error){alert("%s");});', $this->app['direct.exception.message']);
        }
        
        $apiStr = sprintf("Ext.Direct.addProvider(%s);\n%s", $this, $exceptionLogStr);
        
        // force convertion of api to string
        $response = new Response($apiStr);
        
        // set the response header
        $response->headers->set('Content-Type', 'text/javascript');
        
        return $response;
    }