javaspringwebservice-clientjsondoc

How can i specify headers as application/json using JSONDOC


I am using Spring4 to design my REST API. But while I am documenting it using JsonDoc, it is giving me an error as:

The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.

Apache Tomcat/7.0.62

", "status": 415, "statusText": "Unsupported Media Type" }

@ApiMethod
@ApiHeaders(headers={ @ApiHeader(name="Content-Type", allowedvalues="application/json",description="application/json")})
@RequestMapping(value="/test" ,method=RequestMethod.POST)   
public @ApiResponseObject  @ResponseBody ResponseMessage test(@ApiBodyObject @RequestBody TestDto test){
    System.out.println(test.getId());
    return testService.addTestMessage("hello demo");
}

How can I test it?


Solution

  • Check your content type and check your payload format.

    There might be some attribute which are not matching.