1.在请求头中传参数
@ApiImplicitParam(value = "token", name = "token",dataType = "String",paramType="header") |
2.请求体中传递的参数是Java对象
@ApiImplicitParam(name = "Car", value = "新增车辆",paramType = "body", required = true, dataTypeClass = Car.class) |
3.请求体中传递的参数是字符串
@ApiImplicitParam(value = "车牌号", name = "carno",dataType = "String",paramType="query") |
4.传递多个参数
@ApiImplicitParams(value = {@ApiImplicitParam(value = "第几页", name = "pageNo",dataType = "String",paramType="query"),
@ApiImplicitParam(value = "token", name = "token",dataType = "String",paramType="header")})
|
本文详细解析了在API设计中如何使用注解来定义不同类型的参数传递方式,包括请求头、请求体、以及多个参数的组合使用,为开发者提供清晰的指南。
1514

被折叠的 条评论
为什么被折叠?



