【物流助手】调用生成运单API时,提示api unauthorized?
小程序AppID:wx9cac570542869b62 开通了物流服务,目前可以正常获取access_token,但是接着去调用生成订单接口时,就提示api unauthorized rid: 67bf1046-06258a30-1c57a386 请求的URL为:https://api.weixin.qq.com/cgi-bin/express/local/business/order/add?access_token=89_uePAFh-xTaUvKoAY2CioLnjttkwxq-It9yOzYP_wEJvV9Ff3qbUc4CE1_xkg5RnYRK83YQeuqCJBV-LZLMYs6LKg5OehVDvxSM46_358pTpQypRG2JDB0zTh9YMHYCiAAARIM 以上是我使用postMan工具时的提示,我开发环境调用的时候直接提示我请求体有问题:org.springframework.web.client.HttpClientErrorException: 412 Precondition Failed: [no body] 不知道这个是具体什么情况,代码片段如下: HttpEntity<AddExpressOrderRequest> entity = new HttpEntity<>(request, headers); Map<String, Object> response = restTemplate.postForObject(apiUrl, entity, Map.class); 其中request中是包含了官方文档中要求的所有参数实体,如下: @Data public static class AddExpressOrderRequest { private String access_token; // 商家订单ID private String order_id; // 商家订单ID private String openid; // 商家门店编号 private String delivery_id; // 配送公司ID(微信侧分配) private String biz_id; private String custom_remark; private String add_source; private String wx_appid; private String expect_time; private String take_mode; private Contact sender; // 发货人信息 private Contact receiver; // 收货人信息 private Cargo cargo; // 货物信息 private Service service; // 货物信息 private Shop shop; // 货物信息 private Insured insured; private String tagid; @Data public static class Contact { private String name; // 联系人姓名 private String mobile; // 联系电话 private String address; // 详细地址 private String tel; // 发件人座机号码,若不填写则必须填写 mobile,不超过32字节 private String company; // 发件人公司名称,不超过64字节 private String post_code; // 发件人邮编,不超过10字节 private String country; // 发件人国家,不超过64字节 private String province; // 发件人省份,比如:"广东省",不超过64字节 private String city; // 发件人市/地区,比如:"广州市",不超过64字节 private String area; //发件人区/县,比如:"海珠区",不超过64字节 } @Data public static class Cargo { private Integer count; // 包裹数量, 默认为1 private Double weight; // 货物重量(克) private String space_x; // 货物长度,比如20.0,单位是厘米(cm) private String space_y; // 货物宽度,比如15.0,单位是厘米(cm) private String space_z; // 货物高度,比如10.0,单位是厘米(cm) private CargoDetail detail_list; } @Data public static class CargoDetail { private String name; // 商品名,不超过128字节 private Integer count; // 商品数量 } @Data public static class Shop { private String wxa_path; // 商家小程序的路径,建议为订单页面 private String img_url; // 商品缩略图 url;shop.detail_list为空则必传,shop.detail_list非空可不传。 private String goods_name; // 商品名称, 不超过128字节;shop.detail_list为空则必传,shop.detail_list非空可不传。 private Integer goods_count; // 商品数量;shop.detail_list为空则必传。shop.detail_list非空可不传,默认取shop.detail_list的size private CargoDetail detail_list; } @Data public static class Insured { private String use_insured; // 是否保价,0 表示不保价,1 表示保价 private String insured_value; // 保价金额,单位是分,比如: 10000 表示 100 元 } @Data public static class Service { private String service_type; // 服务类型ID private String service_name; // 服务名称 } }