邮递员:“状态”:404,“错误”:“找不到”,“消息”:“找不到”,

时间:2020-08-05 02:33:05

标签: java postman restful-url

@RestController()
@RequestMapping("/v1/e")
public class EC {
    @PostMapping(path = "{document}", consumes = "application/json", produces = "application/json")
    public ResponseEntity<InputStreamResource> createDocument(@PathVariable Dtype document,@RequestBody String data){
        //code
    }

我正在尝试向邮递员发出发帖请求,以下是我用来发帖的URL

http:// localhost:8080 / v1 / e?document = E_PC

但是,邮递员出现以下错误

{
    "timestamp": "2020-08-05T02:22:03.008+0000",
    "status": 404,
    "error": "Not Found",
    "message": "Not Found",
    "path": "/v1/e"
}

1 个答案:

答案 0 :(得分:0)

您还可以如下使用:

@RestController
@RequestMapping("/v1/e")
public class EC {

  @PostMapping
  public ResponseEntity<?> createDocument(@RequestParam("document") String document){
      //code
  }

}

您的POST REQUESThttp://localhost:8080/v1/e?document=E_PC