商家取消获取的电子面单号
商家取消获取的电子面单号
一、请求参数
| 参数名 | 类型 | 说明 | 示例 |
|---|---|---|---|
| appid | String | 合作伙伴AppId | uwkahf@jfs92 |
| timestamp | String | 当前时间戳 | |
| seller_nick | String | 拼多多商家账号,非店铺名称 | kingdo |
| sign | String | 接口签名 | 如何计算生成见示例代码 |
| waybill_code | String | 非必填 电子面单号 | |
| wp_code | String | 非必填 快递公司code |
二、请求示例代码
Java
@Test public void PddWayBillCancel() throws Exception {
String result =""; String seller_nick = Config.PddSellerNick ; // 拼多多卖家账号 CloseableHttpClient httpclient = HttpClients.createDefault(); HttpPost httpPost = new HttpPost( Config.PddWayBillCancelUrl ); //业务参数 Map<String, String> data = new HashMap<String, String>(); data.put("appid", Config.AppId); data.put("seller_nick", seller_nick); Long timestamp = System.currentTimeMillis() / 1000; data.put("timestamp", timestamp.toString()); // 非必填 电子面单号 data.put("waybill_code", "SF1324807157166"); // 非必填 快递公司code data.put("wp_code", "SF"); // 参数签名 data.put("sign", Utils.Sign(data,Config.AppSecret)); List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>(); for (Map.Entry<String, String> entry : data.entrySet()) { params.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } //发起POST请求 try { httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); HttpResponse httpResponse = httpclient.execute(httpPost); if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { result = EntityUtils.toString(httpResponse.getEntity()); } else { result = ("doPost Error Response: " + httpResponse.getStatusLine().toString()); } } catch (Exception e) { e.printStackTrace();
} System.out.println(result);
}需要注意的是package_info中的id为包裹id ,请不要相同。
三、返回结果
限于篇幅,以下json为部分数据
{ "code": 0, "message": "ok", "data": { "cancel_result": true, "request_id": "16118058368786768" }}返回字段说明
cancel_result : 调用取消是否成功说明: code为0表示成功,非0为失败,message会包含失败原因。失败时一定要注意,可能商户授权过期,或是参数有误。