please i have this error when trying to create a customer. Can some one help me? May be i am missing some thing. I have even try to change the @PostMapping to @RequestMapping till yet. Thks
My Controller code
`@PostMapping("CREATE_CUSTOMER_ENDPOINT") @ResponseStatus(value = HttpStatus.OK) @ApiResponses(value = { @ApiResponse(code = 201, message = "The Customer was Created", response = CustomerDto.class), @ApiResponse(code = 400, message = "Bad Request", response = ResponseError.class), @ApiResponse(code = 500, message = "Unexpected error") })
public ResponseEntity createCustomer(final HttpServletRequest request, @RequestBody CustomerDto customerDto) { if (log.isDebugEnabled()){ log.debug("[CustomerResource] POST {} : Creating customer ", CREATE_CUSTOMER_ENDPOINT); } if(customerDto.getUidpk()!=null) { ResponseError error = new ResponseError(HttpStatus.BAD_REQUEST.getReasonPhrase(), "A customer Already exist with an Uidpk"); log.error("[CustomerResource] The customer Already exist ({}) with an Uidpk", customerDto.getUidpk()); return new ResponseEntity<>(error, null, HttpStatus.BAD_REQUEST); } CustomerDto result = customerService.createCustomer(customerDto); log.debug("[CustomerResource] Customer created ({})", result.getUidpk()); return new ResponseEntity<>(result, HeaderUtil.putLocationHeader(request.getRequestURL().toString() + "/" + result.getUidpk()), HttpStatus.CREATED); } ` My endpoints
private static final String CUSTOMER_SEARCH_USER_ID_ENDPOINT = "/customers/{userId:.+}"; private static final String CREATE_CUSTOMER_ENDPOINT= "/customer"; private static final String UPDATE_CUSTOMER_ENDPOINT= "/customer"; private static final String DELETE_CUSTOMER_ENDPOINT = CREATE_CUSTOMER_ENDPOINT + "/{uidpk}";
This is the response of Postman Postman sample