开发指南 官网
API 2.0 > 3.1 商品 > 3.1.12 批量创建商品

3.1.12 批量创建商品

开启令牌和权限后可调用。签名方式请查看开发指南
场景描述:创建当前店铺的商品信息,需要通过企迈云商系统手工同步到多门店;注:最多能传入100条商品信息

请求地址

请求方式 版本信息 请求地址
POST V2 http://openapi.zvcms.com/api/v2

公共参数

参数 参数类型 是否必填 默认值 描述
OpenId string 密钥Id
GrantCode string 授权code
Token string 签名,参考《数字签名sign》
Timestamp string 当前时间戳
Nonce string 随机正整数
Action string goods.batch-goods-add 接口方法
Params array 业务参数

请求参数

参数 参数类型 是否必填 默认值 描述
goods_data array
 ├0 array
  ├name string 商品名称(支持最多每次100个商品的批量添加)
  ├unit string 单位 (零售时是: 库存单位)
  ├images array 商品图片(数组形式)
  ├use_spec int 是否开启规格 1是 0否 (不开启规格 商品销售类型选择堂食则填写堂食销售价格市场价格和库存,选择外卖填写外卖对应销售价格市场价格和库存.都选都填)(零售-》是否多规格(on or off))
  ├sell_price float 网店售价(注意:此字段仅在零售业务中出现)
  ├type int 1 商品的销售类型 1表示普通商品 2表示套餐商品。默认是1普通商品
  ├recommend_price Money(分) 建议价
  ├cost_price Money(分) 成本价
  ├sales_channels int 销售渠道(1:门店,2:网店)
  ├sales_status string 上下架状态(on or off)
  ├is_card_discount string 是否参加会员折扣(no or yes)
  ├share_text string 分享文字 最大20字
  ├limit_num int 限购数量
  ├limit_user int 限购会员等级
  ├product_no string 实体条码 max:20
  ├text array (数组)【subheading(商品卖点简介),content(内容)】
  ├barcode string 条码 多个条码以 , 隔开
  ├video array (数组) 【link(视频链接)】
  ├category array 商品分类的id(数组形式,一个商品可属于多个分类)
  ├prepare_time TimeStamp 准备时长
  ├prepare_time_type TimeStamp 时间类型。d:日,h:时,m:分
  ├stock int 库存 use_spec = off 时填写
  ├reta_trade_mark string 商品编码,最大支持64位字符,当reta_use_spec为‘off’时必填
  ├brand_id int 品牌id
  ├corner_mark_id int 角标id
  ├base_sales_num int 模拟销量
  ├min_buy_num int 起购数量
  ├validity_period_type int 卡券有效期类型:1-长期有效,2-自定义有效期
  ├market_price Money(分) use_spec为off 时 填写市场价
  ├validity_period_begin TimeStamp 有效期-开始时间
  ├validity_period_end TimeStamp 有效期-结束时间
  ├sort int 排序
  ├is_limit_num_update int 限购数量是否次日更新 0表示不更新 1表示更新
  ├multi_store_ids int type=2时 传multi_store_ids(门店id数组参数)
  ├multi_store_type int multi_store_type多门店类别 1全部适用 2.部分可用 3.部分不可用
  ├entities array
   ├0 array
    ├name string 名称
    ├img string 图片地址
    ├product_no string product_no
    ├market_price string 市场价
    ├sell_price string 零售价
    ├prepare_time int 准备时长
    ├prepare_time_type string 时间类型。d:日,h:时,m:分
    ├stock string 库存
    ├reta_trade_mark string 商品编码,最大支持64位字符
    ├spec array 规格数组["规格ID" => "规格值ID"]
    ├cost_price string 成本价 cost_price
  ├leave_message array
   ├0 array
    ├type string text
    ├name string 文本信息
    ├is_must int 是否必填(1.是 0.否)
    ├Date Data 日期
    ├image string 图片地址
    ├email string 邮箱
    ├IDcard string 身份证号
    ├phone int 手机号
    ├number int 数字
    ├time TimeStamp 时间
    ├datetime DateTime 日期时间
  ├reta_use_spec string 是否多规格,on是,off否
  ├callback_flag string 标记,用来标记请求和返回数据的对应关系,没有传递此参数,默认根据请求数据的顺序返回结果 【可传商品标识reta_trade_mark】

响应参数

参数 参数类型 描述
batch_process_res array
 ├0 array
  ├status bool 请求成功或者失败
  ├code int 成功/错误编码
  ├message string 成功/错误描述
  ├callback_flag string 标记,用来标记请求和返回数据的对应关系,没有传递此参数,默认根据请求数据的顺序返回结果

请求示例

{
    "OpenId": "6dc05b4ac175cf316d226252b05cf685",
    "GrantCode": "782c281f62",
    "Timestamp": "1547186244",
    "Nonce": "658965",
    "Token": "0%2B%2B3c6hthjwAml4ABAXOYF4Q6UY%3D",
    "Action": "goods.batch-goods-add",
    "Params": {
        "goods_data": [
            {
                "name": "商品名称",
                "unit": "份",
                "images": "",
                "use_spec": "0",
                "sell_price": "0.02",
                "type": "",
                "recommend_price": "",
                "cost_price": "",
                "sales_channels": "",
                "sales_status": "",
                "is_card_discount": "",
                "share_text": "",
                "limit_num": "",
                "limit_user": "",
                "product_no": "",
                "text": "",
                "barcode": "",
                "video": "",
                "category": "",
                "prepare_time": "",
                "prepare_time_type": "",
                "stock": "",
                "reta_trade_mark": "",
                "brand_id": "",
                "corner_mark_id": "",
                "base_sales_num": "",
                "min_buy_num": "",
                "validity_period_type": "",
                "market_price": "",
                "validity_period_begin": "",
                "validity_period_end": "",
                "sort": "",
                "is_limit_num_update": "",
                "multi_store_ids": "",
                "multi_store_type": "",
                "entities": [
                    {
                        "name": "",
                        "img": "",
                        "product_no": "",
                        "market_price": "",
                        "sell_price": "",
                        "prepare_time": "",
                        "prepare_time_type": "",
                        "stock": "",
                        "reta_trade_mark": "",
                        "spec": "",
                        "cost_price": ""
                    }
                ],
                "leave_message": [
                    {
                        "type": "",
                        "name": "",
                        "is_must": "",
                        "Date": "",
                        "image": "",
                        "email": "",
                        "IDcard": "",
                        "phone": "",
                        "number": "",
                        "time": "",
                        "datetime": ""
                    }
                ],
                "reta_use_spec": "",
                "callback_flag": ""
            }
        ]
    }
} 

响应示例

{
    "status": "true",
    "code": "0",
    "message": "说明",
    "data": {
        "batch_process_res": [
            {
                "status": "",
                "code": "",
                "message": "",
                "callback_flag": ""
            }
        ]
    }
}

异常示例

{
    "status": true,
    "code": "异常编码,根据不同的业务返回编码",
    "message": "异常说明:查询的信息不存在"
}

错误码

{
    "status": false,
    "code": "系统错误编码:详见全局返回编码",
    "message": "系统错误说明"
}

请求地址

请求方式 版本信息 请求地址
POST V2 http://openapi.zvcms.com/api/v2

公共参数

参数 参数类型 是否必填 默认值 描述
OpenId string 密钥Id
GrantCode string 授权code
Token string 签名,参考《数字签名sign》
Timestamp string 当前时间戳
Nonce string 随机正整数
Action string goods.batch-goods-add 接口方法
Params array 业务参数

请求参数

参数 参数类型 是否必填 默认值 描述
goods_data array
 ├0 array
  ├name string 商品名称(支持最多每次100个商品的批量添加)
  ├category_ids array 商品分类的id(数组形式,一个商品可属于多个分类)
  ├unit string 单位 (零售时是: 库存单位)
  ├images array 商品图片(数组形式)
  ├sell_time_status int 开启分段时销 0- 不开启 1- 开启(注意:此字段仅在餐饮业务中出现)
  ├sell_time array
   ├0 array
    ├time array
     ├0 string 开始时间(格式:00:00:00)(注意:此字段仅在餐饮业务中出现)
     ├1 string 结束时间(格式:23:59:59)(注意:此字段仅在餐饮业务中出现)
  ├production_time int 商品制作时间 单位秒(注意:此字段仅在餐饮业务中出现)
  ├sale_type array 商品销售类型 数组,可选值有 1堂食,2外卖(注意:此字段仅在餐饮业务中出现)
  ├content string 详细介绍(注意:此字段仅在餐饮业务中出现)
  ├pack_cost float 打包费(注意:此字段仅在餐饮业务中出现)
  ├use_spec int 是否开启规格 1是 0否 (不开启规格 商品销售类型选择堂食则填写堂食销售价格市场价格和库存,选择外卖填写外卖对应销售价格市场价格和库存.都选都填)(零售-》是否多规格(on or off))
  ├products array
   ├0 array
    ├market_price float 堂食市场价
    ├out_market_price float 外卖市场价(注意:此字段仅在餐饮业务中出现)
    ├out_sell_price float 外卖销售价格(注意:此字段仅在餐饮业务中出现)
    ├out_stock int 外卖-库存(注意:此字段仅在餐饮业务中出现)
    ├sell_price float 堂食销售价格
    ├product_no string 固定值,传空字符串
    ├stock int 堂食-库存
    ├trade_mark string 商品编码(标识,最大字符长度32位)(注意:此字段仅在餐饮业务中出现)
    ├spec array 数组,键是规格的id,值是规格值的id,一维数组
  ├specs array
   ├0 array
    ├id int 规格id
    ├name string 规格名称
    ├values array
     ├0 array
      ├id int 规格值的id
      ├value string 规格值
      ├image string 规格图片,没有则传空字符串
  ├market_price float 成本价(注意:此字段仅在零售业务中出现)
  ├is_card_discount int 是否参加会员折扣 1参加 0不参加,默认参加(注意:此字段仅在零售业务中出现)
  ├shelve_status int 是否上架,1是0否 商家小程序发布商品传1(注意:此字段仅在零售业务中出现)
  ├pricing_mode int 计价方式 1计数 2计重(注意:此字段仅在零售业务中出现)
  ├is_sell_online int 销售渠道(是否网店销售) 0否1是(注意:此字段仅在零售业务中出现)
  ├is_sell_offline int 销售渠道(是否门店销售) 0否1是(注意:此字段仅在零售业务中出现)
  ├sell_price float 网店售价(注意:此字段仅在零售业务中出现)
  ├property array 《套餐商品》不传此参数。做法 [{"name"(做法名称):"加冰","values":[{"value(做法值)":"少冰"},{"value(做法值)":"多冰"}]},{"name"(做法名称):"甜度","values":[{"value"(做法值):"少糖"}]}]
  ├use_property int 0 《套餐商品》不传此参数。是否开启属性 1.开启 0.关闭。默认是0.关闭
  ├type int 1 商品的销售类型 1表示普通商品 2表示套餐商品。默认是1普通商品
  ├cover_img string 套餐的封面图
  ├goods_ids array 商品id数组 注意:《套餐商品》时传此参数,套餐中包含的其他商品的id
  ├sales int 《套餐商品》不传此参数。产品销量
  ├callback_flag string 标记,用来标记请求和返回数据的对应关系,没有传递此参数,默认根据请求数据的顺序返回结果

响应参数

参数 参数类型 描述
batch_process_res array
 ├0 array
  ├status bool 请求成功或者失败
  ├code int 成功/错误编码
  ├message string 成功/错误描述
  ├callback_flag string 标记,用来标记请求和返回数据的对应关系,没有传递此参数,默认根据请求数据的顺序返回结果
  ├id int 商品 ID

请求示例

{
    "OpenId": "6dc05b4ac175cf316d226252b05cf685",
    "GrantCode": "782c281f62",
    "Timestamp": "1547186244",
    "Nonce": "658965",
    "Token": "0%2B%2B3c6hthjwAml4ABAXOYF4Q6UY%3D",
    "Action": "goods.batch-goods-add",
    "Params": {
        "goods_data": [
            {
                "name": "商品名称",
                "category_ids": "40",
                "unit": "份",
                "images": "",
                "sell_time_status": "0",
                "sell_time": [
                    {
                        "time": [
                            "00:00:00",
                            "23:59:59"
                        ]
                    }
                ],
                "production_time": "90",
                "sale_type": "[1]堂食",
                "content": "介绍",
                "pack_cost": "1",
                "use_spec": "0",
                "products": [
                    {
                        "market_price": "0.03",
                        "out_market_price": "0.03",
                        "out_sell_price": "0.02",
                        "out_stock": "100",
                        "sell_price": "0.02",
                        "product_no": "",
                        "stock": "100",
                        "trade_mark": "",
                        "spec": "\"spec\":{\"606\":107,\"605\":108}"
                    }
                ],
                "specs": [
                    {
                        "id": "101",
                        "name": "规格名称",
                        "values": [
                            {
                                "id": "48",
                                "value": "规格值",
                                "image": ""
                            }
                        ]
                    }
                ],
                "market_price": "0.01",
                "is_card_discount": "1",
                "shelve_status": "1",
                "pricing_mode": "1",
                "is_sell_online": "1",
                "is_sell_offline": "1",
                "sell_price": "0.02",
                "property": "",
                "use_property": "",
                "type": "",
                "cover_img": "",
                "goods_ids": "",
                "sales": "",
                "callback_flag": ""
            }
        ]
    }
} 

响应示例

{
    "status": "true",
    "code": "0",
    "message": "说明",
    "data": {
        "batch_process_res": [
            {
                "status": "",
                "code": "",
                "message": "",
                "callback_flag": "",
                "id": ""
            }
        ]
    }
}

异常示例

{
    "status": true,
    "code": "异常编码,根据不同的业务返回编码",
    "message": "异常说明:查询的信息不存在"
}

错误码

{
    "status": false,
    "code": "系统错误编码:详见全局返回编码",
    "message": "系统错误说明"
}

免费升级

营销功能、插件持续每月更新开发升级

免费专业培训

每月建站、微信营销、电商等互联网增值培训

7×24小时服务支持

400电话、QQ、微信、在线等多渠道售后支持

 

安徽智迈科技股份有限公司 版权所有 Copyright 2009-2018 皖公网安备 34019202000074号 增值电信业务经营许可证:皖B2-20170075