创建/更新商品接口
用于创建和修改商品。
接口说明
创建或更新商品/预约品
- 对于同一服务商,相同的out_id会被认为是同一商品,重复创建会被覆盖(相当于修改)
- 商品和SKU属性字段(attr_key_value_map ),需要通过商品模板接口获取
- 新增商品二级类型参数 product_sub_type (仅小程序酒旅预售应用)
- 如果创建多SKU商品(预约品),调用该接口时不传SKU,通过1.2.3的/sku/batch_save/接口批量创建SKU。
- 对于同一服务商,相同的out_id会被认为是同一商品,重复创建会被覆盖(相当于修改)。
- 商品和SKU属性字段attr_key_value_map的格式:
根据「查询商品模板」查出的模板,可以看到该行业该类型下的商品对应的可传的相关属性,技术需要关心的字段主要是以下几个:
- key - 属性主键,attr_key_value_map的key是什么
- is_required - 是否必传
- is_multi - 是否列表,需要和value_type组合起来看。例如:
- value_type=STRING(表示字符串,具体参见下文),is_multi=true,则表示value是一个字符串列表(也就是list<string>)类型;
- value_type=IMAGE(表示图片控件,具体参见下文),is_multi=true,则表示value是一个图片控件结构体列表(也就是list<ImageStruct>)类型;
- value_type - attr_key_value_map的value类型,枚举可参见后文的表格。
attr_key_value_map的类型是map<string,string>,如果value_type为其他值类型需转换为string
- value_type为整数/浮点数:转为十进制格式的string
- value_type为布尔值:转为"true"或"false"
- value_type为结构体或结构体列表:需要使用json序列化
商品属性详细介绍参考文档:商品发布和查询能力
- 新增商品二级类型参数 product_sub_type (仅小程序酒旅预售应用)
- 创建商品时设置金额与前端用户侧展示关系,见下图。
- 顺序:先上预订商品,再上预售商品,上预售商品时通过 bind_skus 字段关联。
- 注意:如果预售券为多预订商品多门店的通兑券,则需要在 bind_skus 中绑定多门店的预订商品,且在 pois(适用门店)字段中传入对应预订商品所属的 POI_IDs。
- ignore_inapplicable_poi: 仅餐饮支持,如需使用请联系业务加白
基本信息
名称 | 描述 |
---|---|
HTTP URL | https://open.douyin.com/goodlife/v1/goods/product/save/ |
HTTP Method | POST |
Scope | life.capacity.goods.found |
权限要求 | 商品发布 |
请求参数
请求头
access-token必填String
示例:clt.943da17996fb5cebfbc70c044c3fc25a57T54DcjT6HNKGqnUdxzy1KcxFnZ
content-type必填String
固定值"application/json"
Rpc-Transit-Life-AccountString
来客商户根账户ID
Body展开全部子属性
product必填Struct
展开子属性
abilityStruct
商品保存能力开关
展开子属性
account_idString
商家id
skuStruct
单sku商品必传;多sku商品不传,需要单独通过sku接口保存
展开子属性
skusList
展开子属性
请求示例
curl --location --request POST 'https://open.douyin.com/goodlife/v1/goods/product/save/' \ --header 'content-type: application/json' \ --header 'access-token: 0801121846735352506a356a6' \ --data '{"ability":{"ignore_inapplicable_poi":false},"account_id":"SOKrR2tNmU","Base":{"Extra":{"tG6Il9M5Wl":"9sxsaMBV7b"},"LogID":"OuqyEEneg8","Caller":"PEdXQmPri1","Addr":"AP7WmWzJtd","Client":"Eaio76wxV9","TrafficEnv":{"Open":false,"Env":"uAxC2utp2d"}},"product":{"attr_key_value_map":{"uLXV3g2zP1":"nh2zaF06y4"},"out_url":"gw86ppnkx7","product_ext":{"all_sku_sell_out":false,"is_bind_clue_element":false,"eleme_biz_code":"2YNOZy6hMJ","test_extra":{"uids":["sYRxG1Juhh"],"test_flag":false},"agency_rate":6609484460641120340,"display_price":{"low_price":7446760285063067989,"high_price":8595104362293978054},"eleme_extra_info":"mX1bl5mFCZ","auto_online":false,"category_out_id":"cPj1B8Ae49"},"owner_account_id":7852080425400674587,"sold_start_time":3744233877804693240,"sold_end_time":291667280544717040,"out_id":"aetOJBUekN","account_name":"Ialxtop23M","category_id":6108686888958459895,"biz_line":1,"open_biz_type":1,"create_time":9197212018964968207,"product_type":1,"update_time":1839300638289727903,"product_id":"dsfadfasdf-123rdfadsf","category_full_name":"ZFSfQNwTdb","pois":[{"supplier_ext_id":"XilIZREfaN","supplier_id":7636545685877516944,"poi_id":"JFXaGRdCBB"}],"spu_id":"6v1FCOCrXE","creator_account_id":3949939072414034911,"desc":"Wxt3schpXk","telephone":["tXzoe1akBf"],"version":7390568655390824830,"product_name":"FfBBj4nkJg","extra":"84zd6Yk60C","contact_name":"d6G1VcbBRF","product_sub_type":1},"sku":{"stock":{"avail_qty":7862039290227865160,"frozen_qty":377278362892634845,"sold_qty":8214042405203896260,"sold_count":930972618983546445,"limit_type":1,"stock_qty":7717120626306456628},"update_time":260501188496268407,"sku_ext":{"discount_promo":{"PlanId":7753476099034386351,"BrandActivityId":7257710437289801222,"PromoId":5247468261616976411},"ori_skus":{"7136623817841493145":[4841055214965696220]},"bind_product_id":1916975524264590155,"bind_sku_id":6532532121060691640,"takeaway_presale_info":{"takeaway_presale_product_id":6494228058559326217,"takeaway_presale_sku_id":6546469703437796754},"use_sub_rel_stock":false,"life_biz_code":"fUOmy7tpXN","settle_type":7603619766601698443,"origin_stock_qty":269573944591127601,"rel_rule_list":[{"BizId":5615345493919469927,"SharedQty":30117565256218284,"StockRel":false,"PriceRel":false,"Coefficient":"OnnlSJaPc1","ConstantVal":7642530534094369463}],"account_settle":false,"c_mspu_id":1222386802957392808,"biz_id_2c_list":[6375736262188660004],"bind_skus_2c":{"1552584397328393473":[7816093348660674324]}},"origin_amount":7842538335263209121,"out_sku_id":"zXZiPaK8Za","attr_key_value_map":{"0V4xTVpJdC":"d1QvBG5UvO"},"sku_id":"dsfadfasdf-123rdfadsf","create_time":521494270367019648,"bind_skus":["PourM18nVS"],"status":1,"extra":"JJNiLxqHGc","actual_amount":5505919064202693812,"sku_name":"adoasmLUv3"},"skus":[{"origin_amount":8504937151324036788,"status":1,"actual_amount":8488419128286278033,"create_time":1044696664312969517,"update_time":3816202210274697555,"sku_id":"dsfadfasdf-123rdfadsf","stock":{"sold_count":3851445239545400275,"limit_type":1,"stock_qty":3011612410878980429,"avail_qty":5347592252907292241,"frozen_qty":6385813007022595628,"sold_qty":8726061834602820033},"out_sku_id":"inbRlsuJj2","sku_name":"Sj6OR3dwpz","attr_key_value_map":{"PHSlVv0D1X":"3L2OYEe29I"},"bind_skus":["TLF9Ywq8y9"],"extra":"W5iVC7cfHH","sku_ext":{"bind_skus_2c":{"3335573651490348186":[3223608393114741587]},"c_mspu_id":5369915740729346499,"takeaway_presale_info":{"takeaway_presale_sku_id":4694747000487815531,"takeaway_presale_product_id":593903690091084361},"account_settle":false,"origin_stock_qty":3232716876403732585,"ori_skus":{"9062409319480511072":[665309036625646982]},"discount_promo":{"PromoId":2815812179790937610,"PlanId":3056447595776002095,"BrandActivityId":5335158875860075620},"settle_type":3765447049091652150,"use_sub_rel_stock":false,"rel_rule_list":[{"PriceRel":false,"Coefficient":"6YCylsoqqT","ConstantVal":8153303582918190072,"BizId":7914904445338236035,"SharedQty":4463192136505326162,"StockRel":false}],"bind_product_id":7323554859380903242,"biz_id_2c_list":[2854091440872379633],"bind_sku_id":8814859019768483553,"life_biz_code":"kNBwBmQXhO"}}]}'
响应参数
Body展开全部子属性
BaseResp必填Struct
展开子属性
extra必填Struct
扩展信息
展开子属性
dataStruct
展开子属性
响应示例
正常响应示例异常响应示例
{ "data": { "product_id": "dsfadfasdf-123rdfadsf", "sku_ids": { "vrb6hq3tpR": "BrSj0iq2is" }, "extra_map": { "8emp4KeAMK": "8cM33AyY42" }, "error_code": 0, "description": "" }, "extra": { "error_code": 0, "description": "", "sub_error_code": 0, "sub_description": "", "logid": "2025072311364913A51345A7BE1DD8A082", "now": 1753241816 }, "BaseResp": { "StatusMessage": "SpnfE7XBVh", "StatusCode": 6362452517939616000, "Extra": { "WZhNs7Jo4u": "BxclKZ1CDj" } } }
错误码
HTTP 状态码 | 错误码 | 错误码描述 | 排查建议 |
---|---|---|---|
200 | 2100001 | 未知错误 | 重试接口,重试3次仍报错联系抖音生活服务技术支持 |
200 | 2100004 | 系统繁忙,此时请开发者稍候再试 | 重试接口,重试3次仍报错联系抖音生活服务技术支持 |
200 | 2100005 | 参数不合法 | 更换参数 |
200 | 2190002 | access_token无效 | 调用接口重新生成access_token |
200 | 2190004 | 应用未获得该能力, 请去https://open.douyin.com/申请 | 应用申请接口权限 |
200 | 2190008 | access_token过期,请刷新或重新授权 |