Postman参数为JSON数据(创建订单)

1、问题:为了模拟创建订单,开发给了一个接口,http://10.16.11.248:8084/outsideQijianOrder/createOrder2qijian.do?json=

2、模拟订单测试数据,具体json数据如下:

{

    "orderInfo": {

        "channel": "QJW",

        "channelCode": "QJW_2048",

        "thirdOrderCode": "201908908774848",

        "orderCode": "QJWS201908908774848",

        "patientCode": "3848475857",

        "businessType": "O2O",

        "deliveryServiceType": "DELIVERY_SFENG",

        "deliveryType": "REAL_TIME",

        "orderNote": "备注一下来来来",

        "freightAmount": "5.00",

        "discountAmount": "1.00",

        "thirdSubsidyAmount": "2.00",

        "needPayAmount": "7.60",

        "isInvoiceNeed":true,

        "invoiceInfo": {

            "invoiceContent": "食品",

            "invoicePhone": "18122788377",

            "invoiceTitle": "大参林",

            "invoiceCode": "441522123456"

        },

        "contact":{

        "name":"贝贝酱",

        "phone":"18122788366",

        "address":{

        "detailAddress":"龙溪大道410号",

        "provinceCode":"",

        "provinceName":"广东省",

        "cityCode":"",

        "cityName":"广州市",

        "districtCode":"",

        "districtName":"荔湾区"

            }

        },

        "goodsList": [

            {

            "channelPrice": "2.00",

            "exercisePrice": "1.45",

            "goodsCode": "8105147",

            "dosage": "用法用量",

            "quantity": 2

            },

            {

            "channelPrice": "2.70",

            "exercisePrice": "2.70",

            "goodsCode": "8101105",

            "dosage": "用法用量",

            "quantity": 1

            }

        ]

    }

}

3、Postman操作如下:

3.1、打开Postman,输入接口链接http://10.16.11.248:8084/outsideQijianOrder/createOrder2qijian.do,设置header的Content-Type为application/json:

图1

3.2、在Body输入JSON数据:

图2

3.3、点击Send,返回如下:

图4

3.4、问题来了,在订单管理并没有生成此订单。

4、解决:改成Params参数的形式传递json值就了。

4.1、点击Params,输入json和json对应的值:

图5

4.2、点击Send,返回如下:

图6

4.3、订单管理页面有对应订单的生成。

5、原因:没通过body拿数据。(开发回复)

6、备注:推荐一个转换json的工具,可以格式化校验json,可以压缩json数据等,http://www.bejson.com/

图7
图8

你可能感兴趣的:(Postman参数为JSON数据(创建订单))