title: Flask + Flask-RESTful: Match specific variables to routes
body: <p>How can I achieve the following?</p>
  
  <pre><code># only if model_type in ['a', 'b', 'c']
  api.add_resource(FooAPI, '/&lt;string:model_type'&gt;
  
  # only if model_type in ['x', 'y', 'z']
  api.add_resource(BarAPI, '/&lt;string:model_type'&gt;
  </code></pre>
  
  <p>Rather than having the following code:</p>
  
  <pre><code>api.add_resource(FooAAPI, '/a'&gt;
  api.add_resource(FooBAPI, '/b'&gt;
  api.add_resource(FooCAPI, '/c'&gt;
  
  api.add_resource(BarXAPI, '/x'&gt;
  api.add_resource(BarYAPI, '/y'&gt;
  api.add_resource(BarZAPI, '/z'&gt;
  </code></pre>