文档中心 > API类目 > 淘宝买菜

taobao.freshx.promotion.coupon.create (创建优惠券)

创建优惠券

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
param CreateCouponDo 可选 创建优惠券
  • └ spread_end_time
  • Date
  • 可选
  • 2021-03-01 00:00:00
  • 领取的开始时间
  • └ only_new_user
  • Boolean
  • 可选
  • false
  • 是否新用户专享
  • └ effective_end_time
  • Date
  • 可选
  • 2021-03-01 00:00:00
  • 核销结束时间
  • └ store_id
  • Number
  • 必须
  • 1
  • 站点id
  • └ title
  • String
  • 必须
  • 满3减2
  • 优惠券名称
  • └ total_count
  • Number
  • 必须
  • 100
  • 发放总数
  • └ type
  • Number
  • 必须
  • 1
  • 优惠券类型1-店铺通用券,2-店铺品类券 3-单品券
  • └ effective_start_time
  • Date
  • 可选
  • 2021-03-01 00:00:00
  • 核销开始时间
  • └ decrease_money
  • Number
  • 必须
  • 200
  • 优惠券面额单位分
  • └ effective_time_mode
  • String
  • 必须
  • 1
  • 核销时间模式
  • └ item_id
  • Number
  • 可选
  • 1
  • 商品id
  • └ effective_start_interval
  • Number
  • 可选
  • 100000
  • 领取之后有效时间开始
  • creator_user
  • User
  • 可选
  • 创建人
  • └ user_nick
  • String
  • 可选
  • 菜菜
  • 创建人nick
  • └ client_ip
  • String
  • 可选
  • 127.0.1
  • 客户端ip
  • └ user_id
  • String
  • 可选
  • 11
  • 创建人id
  • └ instruction
  • String
  • 可选
  • 满3元可用
  • 使用说明
  • └ effective_interval
  • Number
  • 可选
  • 100000
  • 领取后有效时长
  • └ start_fee
  • Number
  • 必须
  • 300
  • 核销金额门槛单位分
  • └ person_limit_count
  • Number
  • 可选
  • 10
  • 每人限领数量
  • └ category_list
  • Number []
  • 可选
  • [1,2,3]
  • 类目id
  • └ outer_id
  • String
  • 必须
  • 1111
  • 外部业务编号
  • └ spread_start_time
  • Date
  • 可选
  • 2021-03-01 00:00:00
  • 领取开始时间
  • modifier_user
  • User
  • 可选
  • 修改人
  • └ user_nick
  • String
  • 可选
  • 菜菜
  • 修改人nick
  • └ client_ip
  • String
  • 可选
  • 127.0.0.1
  • 客户端ip
  • └ user_id
  • String
  • 可选
  • 1
  • 修改人id
  • crowd_list
  • CrowdDO []
  • 可选
  • 人群列表
  • └ extra
  • String
  • 可选
  • 扩展参数
  • └ crowd_id
  • String
  • 可选
  • 12312
  • 人群id
  • └ type
  • Number
  • 可选
  • 1
  • 人群类型 1-新客 2-老客 3-指定人群(需要填写人群id)

响应参数

名称 类型 示例值 描述
result CouponInfoDo true 结果
  • └ uuid
  • String
  • 2534b192b85c402facd4e64ab4a8a7ac
  • uuid
  • └ template_code
  • Number
  • 5610301021
  • 优惠券模板id
  • └ coupon_type
  • Number
  • 47501
  • 优惠券类型

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
FreshxPromotionCouponCreateRequest req = new FreshxPromotionCouponCreateRequest();
FreshxPromotionCouponCreateRequest.CreateCouponDo obj1 = new FreshxPromotionCouponCreateRequest.CreateCouponDo();
obj1.setSpreadEndTime(StringUtils.parseDateTime("2021-03-01 00:00:00"));
obj1.setOnlyNewUser(false);
obj1.setEffectiveEndTime(StringUtils.parseDateTime("2021-03-01 00:00:00"));
obj1.setStoreId(1L);
obj1.setTitle("满3减2");
obj1.setTotalCount(100L);
obj1.setType(1L);
obj1.setEffectiveStartTime(StringUtils.parseDateTime("2021-03-01 00:00:00"));
obj1.setDecreaseMoney(200L);
obj1.setEffectiveTimeMode("1");
obj1.setItemId(1L);
obj1.setEffectiveStartInterval(100000L);
FreshxPromotionCouponCreateRequest.User obj2 = new FreshxPromotionCouponCreateRequest.User();
obj2.setUserNick("菜菜");
obj2.setClientIp("127.0.1");
obj2.setUserId("11");
obj1.setCreatorUser(obj2);
obj1.setInstruction("满3元可用");
obj1.setEffectiveInterval(100000L);
obj1.setStartFee(300L);
obj1.setPersonLimitCount(10L);
obj1.setCategoryList(new Long[] { 1,2,3 };
);
obj1.setOuterId("1111");
obj1.setSpreadStartTime(StringUtils.parseDateTime("2021-03-01 00:00:00"));
FreshxPromotionCouponCreateRequest.User obj3 = new FreshxPromotionCouponCreateRequest.User();
obj3.setUserNick("菜菜");
obj3.setClientIp("127.0.0.1");
obj3.setUserId("1");
obj1.setModifierUser(obj3);
List<FreshxPromotionCouponCreateRequest.CrowdDO> list5 = new ArrayList<FreshxPromotionCouponCreateRequest.CrowdDO>();
FreshxPromotionCouponCreateRequest.CrowdDO obj6 = new FreshxPromotionCouponCreateRequest.CrowdDO();
list5.add(obj6);
obj6.setExtra("无");
obj6.setCrowdId("12312");
obj6.setType(1L);
obj1.setCrowdList(list5);
req.setParam(obj1);
FreshxPromotionCouponCreateResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());

响应示例

  • XML示例
  • JSON示例
<freshx_promotion_coupon_create_response>
    <result>
        <uuid>2534b192b85c402facd4e64ab4a8a7ac</uuid>
        <template_code>5610301021</template_code>
        <coupon_type>47501</coupon_type>
    </result>
</freshx_promotion_coupon_create_response>

异常示例

  • XML示例
  • JSON示例
<error_response>
    <code>50</code>
    <msg>Remote service error</msg>
    <sub_code>isv.invalid-parameter</sub_code>
    <sub_msg>非法参数</sub_msg>
</error_response>

错误码解释

错误码 错误描述 解决方案

API工具

如何获得此API

FAQ

返回
顶部