Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3683

Postman not sending @requestparams to spring application, but it works if i manually type the url in

$
0
0

I am trying to implement pagination in my spring application,however I am using @requestParams. Howver Postman is unable to send the parameters to my get methods which results in them picking the default value assigned.

I have tried rewriting the parameters multiple times, however if i type the entire link with the request params in the link then it worksthis is my get method

@GetMapping("/api/public/categories")public ResponseEntity<CategoryResponse> getallcategories(    @RequestParam(name = "Page_number", defaultValue = Appconstants.PAGE_NUMBER,required = false) Integer pagenumber,    @RequestParam(name = "Page size", defaultValue = Appconstants.PAGE_SIZE,required = false) Integer pgsize,    @RequestParam(name = "Sortfield", defaultValue = Appconstants.SORT_CATEGORIES_BY, required = false) String sortby,    @RequestParam(name = "sortorder", defaultValue = Appconstants.SORT_DEFAULT, required = false) String sortorder) {  return new ResponseEntity<>(      cate.getallcategories(pagenumber, pgsize, sortby, sortorder),      HttpStatus.OK  );}

this is the full urlhttp://localhost:8080/api/public/productsthis is an example of my request](https://i.sstatic.net/pzx7OPwf.png)

When i type the url like this it works


Viewing all articles
Browse latest Browse all 3683

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>