dsc.goods.freight.insert.post (插入商品运费模板信息API)

插入商品运费模板信息API,获取商品运费模板相关信息。

公共参数

请求地址:
环境 HTTP请求地址 HTTPS请求地址
正式环境 http://www.xxx.com/api.php https://www.xxx.com/api.php
公共请求参数:
名称 类型 是否必须 描述
method String API接口名称
app_key String API接口AppKey

请求参数

名称 类型 是否必须 示例值 更多限制 描述
data array 必须 array(array('',''),array('','')) 转为JSON或XML 更新参数
format type 必须 json json或xml 接口类型

响应参数

名称 类型 示例值 描述
tid Number 运费模板ID
ru_id Number 商家ID
type String 0 计算方式(0:按统一运费;1:按叠加运费;)
title Number 标题
update_time String 更新时间
shipping_id String 2,9,14 配送方式ID(字符串拼接方式)
shipping_fee String 2.60 配送方式金额
area_id String 220,221,222,223,224,225,226,227,228 地区市级ID(字符串拼接方式)
top_area_id String 16,25,31 地区省份ID(字符串拼接方式)
sprice String 5.60 地区金额

请求示例

  • PHP(json格式)
  • PHP(xml格式)
$url="http(s)://www.xxx.com/api.php?app_key=A788F457-1A7D-4CC7-ABA0-BFE212BCCD9A&method=dsc.freight.insert.post&format=json"
$Http = new Http();
 
$data=array(
array(
'tid' => '1',
'ru_id' => '0',
'type' => '1',
'title' => '江浙沪地区',
),
array(
'tid' => '1',
'ru_id' => '0',
'shipping_id' => '9,16',
'shipping_fee' => '1.30',
),
array(
'tid' => '1',
'ru_id' => '0',
'area_id' => '220,221,222,223,224,225,226,227,228,229,230,231,232,321,383,384,385,386,387,388,389,390,391,392,393',
'top_area_id' => '16,25,31',
'sprice' => '6.00',
)
)
 
$data = json_encode($data); // 对变量进行 JSON 编码
$argument=array(
'data' => $data
)
 
$Http->doPost($url, $argument);
$url="http(s)://www.xxx.com/api.php?app_key=A788F457-1A7D-4CC7-ABA0-BFE212BCCD9A&method=dsc.goods.freight.insert.post&format=xml"
$Http = new Http();
 
$data = '<?xml version="1.0" encoding="utf-8"?>
<item id="0">
<tid>1</tid>
<ru_id>0</ru_id>
<type>1</type>
<title>江浙沪地区</title>
</item>
<item id="1">
<tid>1</tid>
<ru_id>0</ru_id>
<shipping_id>9,16</shipping_id>
<shipping_fee>1.30</shipping_fee>
</item>
<item id="2">
<tid>1</tid>
<ru_id>0</ru_id>
<area_id>220,221,222,223,224,225,226,227,228,229,230,231,232,321,383,384,385,386,387,388,389,390,391,392,393</area_id>
<top_area_id>16,25,31</top_area_id>
<sprice>6.00</sprice>
</item>
</dsc>';
 
$data = htmlspecialchars($data); // 将特殊字符转换为 HTML 实体
$argument = array(
'data' => $data
);
 
$Http->doPost($url, $argument);

异常示例

  • XML
  • JSON
<dsc>
<result>success</result>
<error>0</error>
<msg>数据提交成功</msg>
</dsc>
{
"result": "success",
"error": 0,
"msg": "数据提交成功",
}

错误码解释

错误码 错误描述 解决方案
error 返回值

0:数据提交成功

1:数据提交失败,参数不存在

2:存在不可传参的参数

返回
顶部