title: WP REST API | RESTful URL parameters
body: <p>I am creating a custom route using WP API this way:</p>
  
  <pre><code> register_rest_route( 'service/v1', 'shopping', array(
          'methods'  =&gt; WP_REST_Server::READABLE,
          'callback' =&gt; 'my_awesome_function',
          ));
  </code></pre>
  
  <p>I am writing the following function:</p>
  
  <pre><code>function my_awesome_function($request_data) {
      $parameters = $request_data-&gt;get_params();
      if( !isset( $parameters['product'] ) || empty($parameters['product']) ){
          return array( 'error' =&gt; 'No product provided' );
      }else{
          $product = $parameters['product'];\
  
         return array( 'Product' =&gt; $product );
  
      }
  }
  </code></pre>
  
  <p>This works perfectly fine using this structure www.example.com/wp-json/service/v1/shopping?product=perfume</p>
  
  <p>However I want it to work in a RESTful way using the URL: www.example.com/wp-json/service/v1/shopping/perfume</p>
  
  <p>Should I change the way I am registering the route or this is not possible and needs to be done through URL rewrite in .htaccess?</p>