获取快递公司代码
获取所有标准电子面单模板
POST https://kf.fw199.com/gateway/pdd/cloudprint/stdtemplates/get
1.请求参数:
参数名 | 类型 | 说明 | 示例 |
---|---|---|---|
appid | String | 合作伙伴AppId | uwkahf@jfs92 |
timestamp | String | 当前时间戳 | |
seller_nick | String | 拼多多商家账号,非店铺名称 | kingdo |
sign | String | 接口签名 | 如何计算生成见示例代码 |
wp_code | String | 非必填 快递公司code |
2. 请求示例代码(Java)
@Test
public void getCloudPrintStdTpl() throws Exception {
String result ="";
String seller_nick = Config.PddSellerNick ; // 拼多多卖家账号
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost( Config.PddCloudPrintStdTplGetUrl );
//业务参数
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());
// 非必填 快递公司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);
}
3. 返回结果如下:
限于篇幅,以下json为部分数据
{
"code": 0,
"message": "ok",
"data": [{
"standard_templates": [{
"standard_template_id": 3,
"standard_template_name": "标准模板",
"standard_template_url": "https://file-link.pinduoduo.com/tt_std",
"standard_waybill_type": 1
}, {
"standard_template_name": "自定义模板",
"standard_template_url": "https://file-link.pinduoduo.com/customArea",
"standard_waybill_type": 2
}, {
"standard_template_id": 64,
"standard_template_name": "快递一联单",
"standard_template_url": "https://file-link.pinduoduo.com/tt_one",
"standard_waybill_type": 3
}, {
"standard_template_id": 107,
"standard_template_name": "快递便携式一联单",
"standard_template_url": "https://file-link.pinduoduo.com/tt_one",
"standard_waybill_type": 9
}],
"wp_code": "TT"
}, {
"standard_templates": [{
"standard_template_id": 20,
"standard_template_name": "标准模板",
"standard_template_url": "https://file-link.pinduoduo.com/sdsd_std",
"standard_waybill_type": 1
}, {
"standard_template_name": "自定义模板",
"standard_template_url": "https://file-link.pinduoduo.com/customArea",
"standard_waybill_type": 2
}],
"wp_code": "SDSD"
}, {
"standard_templates": [{
"standard_template_id": 77,
"standard_template_name": "标准模板",
"standard_template_url": "https://file-link.pinduoduo.com/hywl_std",
"standard_waybill_type": 1
}],
"wp_code": "HYWL"
}, {
"standard_templates": [{
"standard_template_id": 76,
"standard_template_name": "标准模板",
"standard_template_url": "https://file-link.pinduoduo.com/anky_std",
"standard_waybill_type": 1
}],
"wp_code": "ANKY"
}, {
"standard_templates": [{
"standard_template_id": 80,
"standard_template_name": "标准模板",
"standard_template_url": "https://file-link.pinduoduo.com/zysfwl_std",
"standard_waybill_type": 1
}],
"wp_code": "ZYSFWL"
}, {
"standard_templates": [{
"standard_template_id": 68,
"standard_template_name": "标准模板",
"standard_template_url": "https://file-link.pinduoduo.com/ydgj_std",
"standard_waybill_type": 1
}, {
"standard_template_id": 93,
"standard_template_name": "快递一联单",
"standard_template_url": "https://file-link.pinduoduo.com/ydgj_one",
"standard_waybill_type": 3
}],
"wp_code": "YDGJ"
}, {
"standard_templates": [{
"standard_template_id": 4,
"standard_template_name": "标准模板",
"standard_template_url": "https://file-link.pinduoduo.com/ht_std",
"standard_waybill_type": 1
}, {
"standard_template_name": "自定义模板",
"standard_template_url": "https://file-link.pinduoduo.com/customArea",
"standard_waybill_type": 2
}, {
"standard_template_id": 37,
"standard_template_name": "快递一联单",
"standard_template_url": "https://file-link.pinduoduo.com/ht_one",
"standard_waybill_type": 3
}, {
"standard_template_id": 99,
"standard_template_name": "快递便携式一联单",
"standard_template_url": "https://file-link.pinduoduo.com/ht_one",
"standard_waybill_type": 9
}],
"wp_code": "HT"
}, {
"standard_templates": [{
"standard_template_id": 74,
"standard_template_name": "标准模板",
"standard_template_url": "https://file-link.pinduoduo.com/zzsy_std",
"standard_waybill_type": 1
}],
"wp_code": "ZZSY"
}, {
"standard_templates": [{
"standard_template_id": 79,
"standard_template_name": "标准模板",
"standard_template_url": "https://file-link.pinduoduo.com/wspy_std",
"standard_waybill_type": 1
}],
"wp_code": "WSPY"
}
]
}
说明: code为0表示成功,非0为失败,message会包含失败原因。失败时一定要注意,可能商户授权过期,或是参数有误。
文档更新时间: 2023-03-14 17:01 作者:admin