0

My Rest Api is as below -

@POST
    @Path("/search")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    public Response getProducts(@RequestBody MyClass myclass) throws Exception {
        //my code
    }

i have added default constructor in MyClass and all subsequent classes as well . Every time i hit the URL with this json(sending in request body ) i am getting The HTTP 415 Unsupported Media Type client error , Can anyone help on this ? While sending the request i am setting- Content-Type:application/json and Accept - application/json

  • Json i am sending in request body is as follows- {"productPickerSearchRequest": {"planId": "147","categories": [{"categoryId": "2","categoryName": "ANALGESICS"}],"criterias": [{"field": "product","operatorType": "1","value": "string","dataType": "1","operator": "equals"}],"qResultFilter": {"pageIndex": "1","pageSize": "200","bufferSize": "1","newFilter": "true"}}} – Deepika Shetty Aug 21 '20 at 06:33
  • Are you using Postman to send your request? – javaguy Aug 21 '20 at 06:54
  • Also, please post here your complete class code and screenshot of how you are sending request – javaguy Aug 21 '20 at 06:56
  • Please [edit] the question and update it with request body rather than in the comments. – Smile Aug 21 '20 at 06:56

0 Answers0