title: How to validate data with a Model by POST request sent over REST call(without ActiveForm) - Yii2
body: <p>I am creating a <strong>Yii</strong> application in which data is being sent over <code>POST</code> request to my server via REST calls. As there is no <code>ActiveForm</code> coming in the scenario, what is the best approach to validate data with Model class for which data is being sent and after successful validation, it will be saved into db table.</p>
  
  <p>I had gone through official docs but didn't find anything related. As inbuilt approach is given for <code>ActiveForm</code> <code>$model-&gt;validate()</code>, I am wondering if something like this is there as easy as calling a function for the data posted without <code>ActiveForm</code> to validate that data with my <code>Model</code> class.</p>
  
  <p>I know it can be done with <code>isset($_POST['somefield']</code> but it is a bit traditional approach &amp; to be repeated for each field (personally I feel it's a boring activity to check if data is posted in a field and then perform validation for each field separately).</p>
  
  <p>Is there any official doc which I missed? Or if it is not given in doc, what would be the best approach?</p>
  
  <p>Suggest me something to create code magic..</p>