文档中心 > API类目 > 属性类型API

dsc.attribute.update.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

请求�数

�称 类型 是�必须 示例值 更多�制 �述
attr_id Number �选 (唯一性) 属性ID
format type 必须 json json或xml 接�类型

�应�数

�称 类型 示例值 �述
attr_id Number 属性ID
cat_id Number 属性类型ID
attr_name String 属性�称
attr_cat_type Number 分类筛选样�
attr_input_type Number 该属性值的录入方�
attr_type Number 属性是��选
attr_values Text �选值列表
attr_index Number 能�进行检索
sort_order Number 排�
is_linked Number 相�属性值的商�是�关�

请求示例

  • PHP(jsonæ ¼å¼�)
  • PHP(xmlæ ¼å¼�)
$url="http(s)://www.xxx.com/api.php?app_key=A788F457-1A7D-4CC7-ABA0-BFE212BCCD9A&method=dsc.attribute.update.post&format=json"
$Http = new Http();
 
$data=array(
'cat_id' => '1',
'attr_name' => '颜色',
'attr_cat_type' => '1',
'attr_input_type' => '1',
'attr_type' => '1',
'attr_values' => '白色 �色 黑色 红色 绿色 �色 紫色 深兰色',
'attr_index' => '0',
'sort_order' => '10',
'is_linked' => '0'
)
 
$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.attribute.update.post&format=xml"
$Http = new Http();
 
$data = '<?xml version="1.0" encoding="utf-8"?>
<dsc>
<cat_id>1</cat_id>
<attr_name>颜色</attr_name>
<attr_cat_type>1</attr_cat_type>
<attr_input_type>1</attr_input_type>
<attr_type>1</attr_type>
<attr_values>白色 �色 黑色 红色 绿色 �色 紫色 深兰色</attr_values>
<attr_index>0</attr_index>
<sort_order>10</sort_order>
<is_linked>0</is_linked>
</dsc>';
 
$data = htmlspecialchars($data); // 将特殊字符转�为 HTML 实体
$argument = array(
'attr_id' => '4'
'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:�件为空或�数�存在

3:已存在相�数�,无法更新

4:当�数��存在

5:存在��传�的�数

返回
顶部