1 中信_后端调用示例
1.0 通用类
调用方式为post,post写上 http://127.0.0.1:8080/test/testApi
headers :Content-Type = application/json
参考通用类:
https://www.cnblogs.com/1446358788-qq/articles/17561777.html
1.1 入参:空
{ "interfaceName":"com.ddwei.application.moduleA.service.impl.CallServerServiceImpl", "methodName":"blank", "paramsList":[] }
1.2 入参:字符串
{ "interfaceName":"com.ddwei.application.moduleA.service.impl.CallServerServiceImpl", "methodName":"params", "paramsList":[{ "index":"1", "type":"java.lang.String", "data":"aaa" }, { "index":"2", "type":"java.lang.Integer", "data":111 }] }
1.3 入参:对象
{ "interfaceName":"com.ddwei.application.moduleA.service.impl.CallServerServiceImpl", "methodName":"methodA", "paramsList":[{ "index":"1", "type":"com.ddwei.api.bff.moduleA.dto.request.CallServerQuery", "data":{ "inputPropertyA":"111", "inputPropertyB":"222"} }] }
1.4 入参:PageParm
{ "interfaceName":"com.ddwei.application.moduleA.service.impl.CallServerServiceImpl", "methodName":"methodC", "paramsList":[{ "index":"1", "type":"com.ddwei.api.temp.jarBao.PageParm", "fanxingClass":"com.ddwei.api.bff.moduleA.dto.response.CallServerDto", "fanxingFieldName":"data", "data":{ "data":{ "user":{ "userId":1222, "orgId":"11" }, "outputPropertyA":"张飞" }, "pageNo":1, "pageSize":100 } }] }
1.5 入参:包含对象
注意:对象命名为data
{ "interfaceName":"com.ddwei.application.moduleA.service.impl.CallServerServiceImpl", "methodName":"fanxing", "paramsList":[{ "index":"1", "type":"com.ddwei.api.bff.moduleA.dto.request.CallServerParentQuery", "fanxingClass":"com.ddwei.api.bff.moduleA.dto.request.CallServerQuery", "fanxingFieldName":"data", "data":{ "data":{ "user":{ "userId":1222, "orgId":"11" }, "inputPropertyA":"aaa" }, "colum1":"1" } }] }
@Getter @Setter @Builder @AllArgsConstructor @NoArgsConstructor public class CallServerParentQuery { private String colum1; private CallServerQuery data; } @Getter @Setter @Builder @AllArgsConstructor @NoArgsConstructor public class CallServerQuery implements Serializable { /** * 属性A */ @NotNull(message = "属性A不能为空") private String inputPropertyA; /** * 属性B */ private String inputPropertyB; } void fanxing(CallServerParentQuery query) throws DBusinessException;
1.6 File上传(暂定)

2 postman官网
2.1 常用案例
- 通用案例
POST https://postman-echo.com/post
- 用户登录
POST https://reqres.in/api/login
- 无参get请求
https://api.apiopen.top/api/sentences

2.2 官方文档教程
3 常见错误
3.1 JSON parse error: Unexpected character (' ' (code 12288 / 0x3000))
中文空格导致,json解析失败
3.2 Unsupported Media Type

诸葛
浙公网安备 33010602011771号