title: Calling flask restful API resource methods
body: <p>I'm creating an API with Flask that is being used for a mobile platform, but I also want the application itself to digest the API in order to render web content. I'm wondering what the best way is to access API resource methods inside of Flask? For instance if I have the following class added as a resource:</p>
  
  <pre><code>class FooAPI(Resource):
      def __init__(self):
          # Do some things
          super(FooAPI, self).__init__()
      def post(self, id):
          #return something
      def get(self):
          #return something
  
  api = Api(app)
  api.add_resource(FooAPI, '/api/foo', endpoint = 'foo')
  </code></pre>
  
  <p>Then in a controller I want:</p>
  
  <pre><code>@app.route("/bar")
  def bar():
     #Get return value from post() in FooAPI
  </code></pre>
  
  <p>How do I get the return value of post() from FooAPI? Can I do it somehow through the api variable? Or do I have to create an instance of FooAPI in the controller? It seems like there has to be an easy way to do this that I'm just not understanding...</p>