# Add shipping templates

# Interface call request specification

Http request method: POST
https://api.weixin.qq.com/product/delivery/insert_freight_template?access_token=xxxxxxxxx

# Request Parameter Sample

{
    "freight_template":{
        Xinjiang Tibet high postage, Beijing conditions free postage, other areas low postage,
        "valuation_type":1,
        " send_time":7,
        "address_info":
        {
            "province_name":" Beijing, " 
            "city_name":" Beijing, " 
            "county_Name ":" "
        },
        "delivery_type":1,
        "delivery_id":[""],
        "shipping_method":2,
        "all_condition_free_detail " :
        {
            "condition_free_detail_list":
            [
               {
                   "address_Infos ":
                   [
                       {
                           "province_name":" Beijing. " 
                       }
                   ],
                   "min_piece":2,
                   "min_amount":100,
                   "valuation_flag":1,
                   "amount_flag":1
                } 
            ]
        },
        "all_freight_calc_method":
        {
            "freight_calc_method_list":
            [
               {
                   "address_info":
                   [
                       {
                           "province_Name ":" Xinjiang Uygur Autonomous Region "
                       },
                       {
                           "province_Name ":" Tibet Autonomous Region "
                       }
                   ],
                   "is_default":false,
                   "first_val_amount":1,
                   "first_price":1000,
                   "second_val_amount":1,
                   "second_price":800
              },
              {
                   "address_info":[],
                   "is_default":true,
                   "first_val_amount":1,
                   "first_price":800,
                   "second_val_amount":1,
                   "second_price":400
              }

            ]
        },
        "is_default":0,
        "not_send_area":
        {
            "address_info":[]
        }
    } 
}

# Return Package Example

{
    "errcode" : 0,
    "errcode" : "",
}

# Request Parameter Dxplaination

parameter type Is it necessary to fill out Introductions
freight_template.name string yes Shipping Template Name
freight_template.valuation_type nunber yes Billing method
freight_template.send_time number yes Delivery time
freight_template.address_info object no Shipping Address
freight_template.delivery_type number yes Distribution mode
freight_template.delivery_id[] array no List of courier companies
freight_template.shipping_method number yes Whether or not to send, do not send in all_freight_calc_Method Specify default freight
freight_template.all_condition_free_detail object no Terms of Service Details
freight_template.all_freight_calc_method object no Specific billing method
freight_template.is_default number no Is the default template
freight_template.not_send_area object no Non Shipping Area

# object-address_info

parameter type Is it necessary to fill out Introductions
province_name string no province
city_name string no city
county_name string no Districts and counties

# object-all_condition_free_detail

Billing by weight min_weight和min_Fill in at least one, charge by quantity min_piece和min_Fill in at least one amount

parameter type Is it necessary to fill out Introductions
condition_free_detail_list[].address_infos object yes Postal area, address_info
condition_free_detail_list[].min_piece number no Minimum package
condition_free_detail_list[].min_amount number no Minimum Postage Rate
condition_free_detail_list[].min_weight number no Minimum package weight
condition_free_detail_list[].valuation_flag number no Is the billing option set?
condition_free_detail_list[].amount_flag number no Amount set

# object-all_freight_calc_method

parameter type Is it necessary to fill out Introductions
freight_calc_method_list[].address_info object yes Specify locale, structure same as address_info
freight_calc_method_list[].is_default boolen yes Is the default freight rate, and if so, address_Must be empty
freight_calc_method_list[].delivery_id string no Courier company
freight_calc_method_list[].first_val_amount number yes First freight to meet the weight, unit kg
freight_calc_method_list[].first_price number yes The amount of the first freight, in units
freight_calc_method_list[].second_val_amount number yes Renewal unit weight, unit kg
freight_calc_method_list[].second_price number yes Increase in Amount per Unit of Renewal, Unit Points

# object-not_send_area

parameter type Introductions
address_info object No shipping area, structure same address_info

# Return parameter specification

parameter type Introductions
Errcode string Error code
errmsg string Error message

# Enumerate the value -valuation_type

Enumeration value describe
1 By piece
2 By weight

# Enumeration value - send_time

Enumeration value describe
1 4 hours
2 8 hours
3 12 hours.
4 16 hours
5 20 hours
6 24 hours
7 48 hours
8 3 days
9 5 days
10 7 days
11 10 days
12 12 days
13 14 days
14 16 days
15 20 days
16 25 days
17 30 days
18 35 days
19 45 days

# Enumerate the value-delivery_type

Enumeration value describe
1 express delivery

# Enumeration values - shipping_method

Enumeration value describe
1 shipping included
2 Conditional Delivery
3 No Postage

# Return code

Return code Type of error
-1 System exception
-2 Token is too long