# 电子面单模板


接口地址: http://www.damaijia168.com/vv/external/stdtemplates


请求方式: POST


传参方式: JSON


返回格式: JSON


# 请求头参数

参数 类型 必选 示例
Authorization string 授权 access_token 1798c6aadec33d1bc2f5b707f1049aefexxxx

# 请求参数

参数 类型 必选 描述
edition string 版本 默认:1(不传默认为1)
1:1.0,2:2.0

# 请求示例

# 请求代码示例

cURL请求代码示例

curl --location --request POST 'http://www.damaijia168.com/vv/external/lowdecode' \
--header 'Authorization: 73a1e6f00198e0c43215505dcf6e31a61be8****' \
--header 'Content-Type: application/json' \
--header 'Cookie: __yjs_duid=1_dee3bfba5b90592372d209eda95c772a1616035269331; PHPSESSID=me69hpeim7fg7fldklo2gc484p; _csrf=f7f8b1322efa84f154be2ce39cfb59391309ae8243c387678c61b475831aeca9a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22TmC9Hjgipu2m5spZ59cpdGBPSRmyEp1N%22%3B%7D' \
--data-raw '{
    "fields": "tid,type,status,payment,orders,promotion_details,receiver_name,receiver_state,receiver_address,receiver_zip,receiver_mobile,receiver_phone,receiver_country,receiver_town",
    "tid": 123456789,
    "shop_id": 123,
    "order_type": 1
}'

PHP请求代码示例

curl --location --request POST 'http://www.damaijia168.com/vv/external/lowdecode' \
--header 'Authorization: 73a1e6f00198e0c43215505dcf6e31a61be8****' \
--header 'Content-Type: application/json' \
--header 'Cookie: __yjs_duid=1_dee3bfba5b90592372d209eda95c772a1616035269331; PHPSESSID=me69hpeim7fg7fldklo2gc484p; _csrf=f7f8b1322efa84f154be2ce39cfb59391309ae8243c387678c61b475831aeca9a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22TmC9Hjgipu2m5spZ59cpdGBPSRmyEp1N%22%3B%7D' \
--data-raw '{
    "fields": "tid,type,status,payment,orders,promotion_details,receiver_name,receiver_state,receiver_address,receiver_zip,receiver_mobile,receiver_phone,receiver_country,receiver_town",
    "tid": 123456789,
    "shop_id": 123,
    "order_type": 1
}'


JAVA请求代码示例

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"fields\": \"tid,type,status,payment,orders,promotion_details,receiver_name,receiver_state,receiver_address,receiver_zip,receiver_mobile,receiver_phone,receiver_country,receiver_town\",\r\n    \"tid\": 123456789,\r\n    \"shop_id\": 123,\r\n    \"order_type\": 1\r\n}");
Request request = new Request.Builder()
  .url("http://www.damaijia168.com/vv/external/lowdecode")
  .method("POST", body)
  .addHeader("Authorization", "73a1e6f00198e0c43215505dcf6e31a61be8****")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();

Python请求代码示例

import requests
import json

url = "http://www.damaijia168.com/vv/external/lowdecode"

payload = json.dumps({
    "fields": "tid,type,status,payment,orders,promotion_details,receiver_name,receiver_state,receiver_address,receiver_zip,receiver_mobile,receiver_phone,receiver_country,receiver_town",
    "tid": 123456789,
    "shop_id": 123,
    "order_type": 1
})
headers = {
  'Authorization': '73a1e6f00198e0c43215505dcf6e31a61be8****',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

# 响应参数

参数 类型 描述
data object 返回数据
--result object 结果集
--datas object[] 所有 cp 的标准模板
--cp_code string cp 编码
--standard_templates object[] 该 cp 的所有标准模板
--standard_template_id int 模板 id
--standard_template_name string 模板名称
--standard_template_url string 模板 url
--standard_waybill_type int 1 快递标准面单
2 快递三联面单
3 快递便携式三联单
4 快运标准面单
5 快运三联面单
6 快递一联单
--error_code string 错误码
--error_message string 错误信息
--success bool 是否成功
--deduct_money int 消耗点券
status int 状态码,0为成功

# 返回数据

{
  "data":{
        "withholding_money": 1,
    "cainiao_cloudprint_stdtemplates_get_response":{
        "result":{
            "datas":{
                "standard_template_result":[
                    {
                        "cp_code":"YTO",
                        "standard_templates":{
                            "standard_template_do":[
                                {
                                    "standard_template_id":1024,
                                    "standard_template_name":"YTO模板",
                                    "standard_template_url":"http:\/\/xxx",
                                    "standard_waybill_type":1
                                }
                            ]
                        }
                    }
                ]
            },
            "error_code":"ERROR_GET",
            "error_message":"获取面单失败",
            "success":false
        }
    }
    },
  "status": 0
}

# 错误码

状态码(status) 错误信息 解决方案
132 请求格式必须为JSON 修改请求参数格式为json
422 参数列表不合法,在err中会给出提示 根据提示做相应修改
200 认证失败 请确保请求头里的Authorization存在或者未过期