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

  • 功能:接收任何请求(包括x-www-form-urlencoded),并返回请求的原始数据(头、参数、请求体等),适合验证你的报文是否正确。
  • 示例:用x-www-form-urlencoded传参key1=value1,会在响应中看到该参数。

 

  • 用户登录
POST https://reqres.in/api/login
  • Body(x-www-form-urlencoded):
  • email=eve.holt@reqres.in
  • password=cityslicka
  • 功能:模拟登录接口,返回 token(成功)或错误(失败),适合测试表单提交。

 

  • 无参get请求

https://api.apiopen.top/api/sentences

图片

 

 2.2  官方文档教程

  1. 官方主文档(英文,最全面)

     
    地址:https://learning.postman.com/
     
    包含:入门指南、请求发送、集合管理、环境变量、测试脚本、Mock 服务、团队协作等所有功能的详细说明。
  2. 哔哩哔哩
     
    地址:https://www.bilibili.com/video/BV1h54y1L7kz?spm_id_from=333.788.videopod.episodes&vd_source=a692438a2d4a645669959bb9ffd90074&p=24
     
    覆盖基础操作(如发送请求、创建集合),高级功能可能仍为英文。

 


 

3    常见错误

3.1    JSON parse error: Unexpected character (' ' (code 12288 / 0x3000))

中文空格导致,json解析失败

 

3.2    Unsupported Media Type

posted on 2022-02-08 06:45  菜鸟乙  阅读(58)  评论(0)    收藏  举报