Send PathVariable @PostMapping in postman

Dumidu Udayanga :

I want send path variable in post mapping, in postman software.I select post mapping body and then how to do? I checked with @RequestParam vs @PathVariable example,all answers for get method, But I need answer for post method.

@RestController
@RequestMapping("api/v1/customers") 
public class CustomerController {

@PostMapping("/{code}")
    public String postRequest(@PathVariable String code,@RequestBody CustomerDTO dto){
         System.out.println(dto);
         System.out.println(code);
         return "Something";
    }
}
baba :

enter image description here

select post -> add the url -> select body -> choose raw -> select JSON(application/json) -> add your json data -> click send

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=96646&siteId=1