Product Update Columns API 文档
商品-字段更新
接口信息
- 接口地址:
{your-site-url}/api/skill/product/update-columns
- 基础 URL:
{your-site-url} 需替换为你自己的独立站 URL 地址,如 https://your-domain.com/apimanager666
- 请求方式:
POST
- Content-Type:
application/json
- 说明: 此接口用于局部更新商品的指定字段。只更新传入的字段,未传或传空值的字段保持不变。
认证
请求头中需要携带 skill-access-token:
| Header |
值 |
skill-access-token |
{your-skill-access-token} (请替换为你自己的 token) |
请求参数 (Body - JSON)
| 字段 |
类型 |
必填 |
说明 |
id |
int |
✅ 必填 |
产品 ID |
title |
string |
选填 |
商品标题 |
sub_title |
string |
选填 |
商品副标题 |
spu |
string |
选填 |
产品 SPU |
body_html |
string |
选填 |
商品描述(HTML) |
meta_title |
string |
选填 |
SEO 标题(meta title) |
meta_keywords |
string |
选填 |
SEO 关键字(meta keywords) |
meta_description |
string |
选填 |
SEO 描述(meta description) |
status |
int |
选填 |
商品状态。1 激活(上架),2 关闭(下架) |
virtual_sales_count |
int |
选填 |
虚拟销量 |
vendor |
string |
选填 |
产品厂家/品牌名称 |
请求示例
cURL
curl --location --request POST '{your-site-url}/api/skill/product/update-columns' \
--header 'skill-access-token: {your-skill-access-token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 4932,
"title": "test update columns:Morden Lighting Nordic Fabric Shade Black White Floor Lamp",
"sub_title": "test update columns:Morden Lighting Nordic Fabric Shade Black White Floor Lamp subtitle",
"spu": "testxxxx",
"body_html": "<p>test update columns:body html</p>",
"meta_title": "test update columns: meta_title",
"meta_keywords": "test update columns:meta_keywords",
"meta_description": "test update columns:meta_description",
"status": 1,
"virtual_sales_count": 212,
"vendor": "test update columns: ddd"
}'
只更新单个字段示例
curl --location --request POST '{your-site-url}/api/skill/product/update-columns' \
--header 'skill-access-token: {your-skill-access-token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 4932,
"status": 2
}'
返回结果
code 为 200 表示调用成功;code 不为 200 表示调用失败。
成功响应
{
"code": 200,
"data": {
"product_id": 4932
},
"message": "success"
}
返回字段说明
| 字段 |
类型 |
说明 |
code |
Number |
状态码,200 表示成功 |
message |
String |
执行结果的文字描述 |
data.product_id |
int |
更新后的产品 ID |
错误码说明
| 错误码 |
说明 |
100701003 |
商品id为空 |
100701001 |
商品保存报错 |
| 其他错误码 |
商品保存报错 |
注意事项
id 为必填,用于指定要更新的商品
- 只更新传入的字段,未传入的字段保持原值不变
- 传空字符串
"" 或 null 视为不更新该字段
- 相比
/api/skill/product/update,此接口更适合只需修改个别字段的场景,无需传递完整的商品数据