title: What is the best way to put more than 5 @Pathvariable in RestApi Spring?
body: <p>I have too many @PathVariable in one endpoint. How I can minimize it, because it looks endless, maybe create one more objet with all this variable which I need and use @RequestBody or any other ways?</p>
  <pre><code> @GetMapping(&quot;/city/{cityname}/{priceLess}/{priceGreater}/{untilityLess}/{untilityGreater}/{rentORbuy}/{furnished}/{renovated}/{roomsLess}/{roomsGreater}&quot;)
      public ResponseEntity&lt;List&lt;Flat&gt;&gt; findCity(@PathVariable(&quot;cityname&quot;) String cityname,
                                                 @PathVariable(&quot;priceLess&quot;) BigDecimal priceLess,
                                                 @PathVariable(&quot;priceGreater&quot;) BigDecimal priceGreater,
                                                 @PathVariable(&quot;untilityLess&quot;) BigDecimal untilityLess,
                                                 @PathVariable(&quot;untilityGreater&quot;) BigDecimal untilityGreater,
                                                 @PathVariable(&quot;rentORbuy&quot;) Boolean rentORbuy,
                                                 @PathVariable(&quot;furnished&quot;) Boolean furnished,
                                                 @PathVariable(&quot;renovated&quot;) Boolean renovated,
                                                 @PathVariable(&quot;roomsLess&quot;) int roomsLess,
                                                 @PathVariable(&quot;roomsGreater&quot;) int roomsGreater){}
  </code></pre>