使用邮递员客户端通过@RequestParam 和@RequestBody 调用服务
Invoking service with @RequestParam and @RequestBody using postman client
正在尝试调用服务
http://IP:8080/PQRS/LMN/XYZ/runTest/scheduledautomation/1/XYZ
以下 JSON 字符串
[ {"paramName":"TEST_TARGET_IDENTIFIER","paramValue":"ETest"},{"paramName":"TEST_SOURCE_ENTRY_IDENTIFIER","paramValue":"com.pack.etest"}]
@ResponseStatus(value = HttpStatus.NO_CONTENT)
@RequestMapping(value = "/runTest/scheduledautomation/{runId}/{testEngine}", method = RequestMethod.POST)
public void runScheduledAutomatedTest(@RequestParam String cronExpresssion,
@RequestParam(required = false) @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime endTime,
@PathVariable Integer runId,
@PathVariable TestEngine testEngine,
@RequestBody List<TestEngineParam> testEngineParams) throws Exception { //Some Code }
回复:
必需的字符串参数 'cronExpresssion' 不存在
如何在 postman 客户端上混合调用 @RequestParam
和 @RequestBody
服务?
恐怕您想要的有点太多了:RequestParam、RequestBody 以及整个作为 REST 查询的东西。这三件事中至少有两件事是互斥的。
我认为您甚至可以让 Postmaster 将调用的 URL 修改为:
http://IP:8080/PQRS/LMN/XYZ/runTest/scheduledautomation/1/XYZ?cronExpression=your-expression
当然这会破坏您的 REST 接口,但正如我所说:您的处理程序方法有点 "over-ambitious".
正在尝试调用服务 http://IP:8080/PQRS/LMN/XYZ/runTest/scheduledautomation/1/XYZ
以下 JSON 字符串
[ {"paramName":"TEST_TARGET_IDENTIFIER","paramValue":"ETest"},{"paramName":"TEST_SOURCE_ENTRY_IDENTIFIER","paramValue":"com.pack.etest"}]
@ResponseStatus(value = HttpStatus.NO_CONTENT)
@RequestMapping(value = "/runTest/scheduledautomation/{runId}/{testEngine}", method = RequestMethod.POST)
public void runScheduledAutomatedTest(@RequestParam String cronExpresssion,
@RequestParam(required = false) @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime endTime,
@PathVariable Integer runId,
@PathVariable TestEngine testEngine,
@RequestBody List<TestEngineParam> testEngineParams) throws Exception { //Some Code }
回复:
必需的字符串参数 'cronExpresssion' 不存在
如何在 postman 客户端上混合调用 @RequestParam
和 @RequestBody
服务?
恐怕您想要的有点太多了:RequestParam、RequestBody 以及整个作为 REST 查询的东西。这三件事中至少有两件事是互斥的。
我认为您甚至可以让 Postmaster 将调用的 URL 修改为:
http://IP:8080/PQRS/LMN/XYZ/runTest/scheduledautomation/1/XYZ?cronExpression=your-expression
当然这会破坏您的 REST 接口,但正如我所说:您的处理程序方法有点 "over-ambitious".