I am trying to do a call to my REST service to create a supplier. I need the itemCode of the supplied item and the username that wants to create it. Right now, i am call it like this:
th:href="@{/api/supplier/getSupplierViewItem/{username}(username = ${username})/{itemCode}(itemCode = ${item.itemCode})}
Then, my controller should get that petition:
@GetMapping("/getSupplierViewItem/{username:.+}/{itemCode:.+}")
public String getSupplierViewwithItem(@PathVariable("username")String username, @PathVariable("itemCode") String itemCode, ModelMap model){
model.addAttribute("username", username);
model.addAttribute("itemCode", itemCode);
return "createSupplier";
}
However, when I try it, I get this following petition:
http://localhost:8080/api/supplier/getSupplierViewItem/%7Busername%7D(username%20=%20$%7Busername%7D)/01231
Basically, instead of the value of username, I´m getting
{username}(username = ${username})
Which is the best way to send both parameters?