title: how to make paging for this custom rest API?
body: <p>I used this to get best selling product from woocommerce and return the product data in REST API</p>
  
  <p>but i need to make a pagination system so user can define witch page must show.</p>
  
  <pre><code>function featureproduct(){
  $prdtc=wc_get_featured_product_ids();
  $array=array();
  $i=0;
      foreach ($prdtc as $id)
      {
          $res = wc_get_product( $id);
          $array[$i]=array(
  $id,
   $res-&gt;get_name(),
  $res-&gt;get_price(),
  get_the_post_thumbnail_url($id),
  get_permalink($id)
  );
      $i++;
  }
      echo json_encode($array,JSON_FORCE_OBJECT);
  }
  </code></pre>
  
  <p>I need something like that wp-json Used
  for example:</p>
  
  <pre><code>/wp-json/wc/v3/products?per_page=10&amp;page=1
  </code></pre>