title: Yii2 REST API not working properly
body: <p>I am creating an API for get user by YII2 user api by user id. If I pass user id then it is working good but If I pass string then I get below error.</p>
  
  <pre><code>&lt;pre&gt;An Error occurred while handling another error:
  yii\base\InvalidParamException: Response content must not be an array. in /var/www/html/vendor/yiisoft/yii2/web/Response.php:1020
  Stack trace:
  #0 /var/www/html/vendor/yiisoft/yii2/web/Response.php(313): yii\web\Response-&amp;gt;prepare()
  #1 /var/www/html/vendor/yiisoft/yii2/web/ErrorHandler.php(128): yii\web\Response-&amp;gt;send()
  #2 /var/www/html/vendor/yiisoft/yii2/base/ErrorHandler.php(111): yii\web\ErrorHandler-&amp;gt;renderException(Object(yii\web\NotFoundHttpException))
  #3 [internal function]: yii\base\ErrorHandler-&amp;gt;handleException(Object(yii\web\NotFoundHttpException))
  #4 {main}
  Previous exception:
  yii\base\InvalidRouteException: Unable to resolve the request: categories/wewqewqe in /var/www/html/vendor/yiisoft/yii2/base/Controller.php:127
  Stack trace:
  #0 /var/www/html/vendor/yiisoft/yii2/base/Module.php(523): yii\base\Controller-&amp;gt;runAction(&amp;#039;wewqewqe&amp;#039;, Array)
  #1 /var/www/html/vendor/yiisoft/yii2/web/Application.php(102): yii\base\Module-&amp;gt;runAction(&amp;#039;categories/wewq...&amp;#039;, Array)
  #2 /var/www/html/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application-&amp;gt;handleRequest(Object(yii\web\Request))
  #3 /var/www/html/index.php(16): yii\base\Application-&amp;gt;run()
  #4 {main}
  
  Next yii\web\NotFoundHttpException: Page not found. in /var/www/html/vendor/yiisoft/yii2/web/Application.php:114
  Stack trace:
  #0 /var/www/html/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application-&amp;gt;handleRequest(Object(yii\web\Request))
  #1 /var/www/html/index.php(16): yii\base\Application-&amp;gt;run()
  #2 {main}&lt;/pre&gt;
  </code></pre>
  
  <p>I am using <code>swagger</code> for executing APIs and Endpoint of the API is</p>
  
  <pre><code>users/{id}
  </code></pre>
  
  <p>Work fine when enter </p>
  
  <pre><code>/users/1
  </code></pre>
  
  <p>Get error when</p>
  
  <pre><code>/users/asdf
  </code></pre>
  
  <p><strong>Web.php</strong> </p>
  
  <pre><code>'users/&lt;id:\d+&gt;' =&gt; 'users/',
  </code></pre>