2

I am trying to write a web service method for get request and its return type is ResponseEntity. But when i trying to run this from Postman then its gives response body as Not acceptable. following is the result and code of my method.

<html>
    <head>
        <title>Error</title>
    </head>
    <body>Not Acceptable</body>
</html>

Code:-

 @GetMapping("/v1/showMyDetails.html")
 public ResponseEntity tryingGetWithAnnotation(){
     ResponseEntity responseEntity = null;
     JSONObject jsonObj = new JSONObject();
     jsonObj.put("name","nikhil");
     responseEntity = new ResponseEntity(jsonObj,HttpStatus.OK);
     return responseEntity;
 }

Thanks in Advance

0 Answers0