alibaba.benefit.draw (抽奖接口)

功能:抽奖功能,供小程序抽奖调用 业务逻辑:程序中通过奖池编号ename,业务方身份appName来查询奖池,根据授权用户(买家)来确认抽奖用户。然后程序进行抽奖流程。 小程。 安全保障:为保证数据不会越权,需要买家授,并且验证系统参数appKey。只有通过授权的,并且 appkey验证通过的,才会进入抽奖流程,否则直接失败。 因为appkey是系统参数,并且程序内部可以验证appkey和业务身份appName的关系 是否一致,所以可以保证参数appName的合法性,没有越权。

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
ename String 必须 82a36d90e6b5401c86623bf579a67b88 奖池唯一标识,奖池创建时即生成
app_name String 必须 promotioncenter-3000000002037004 调用方AppName:规定为promotioncenter-${appId}
ip String 可选 127.0.0.1 调用方应用ip,非必填

响应参数

名称 类型 示例值 描述
result Result 接口返回model
  • └ result_msg
  • String
  • 抽奖成功
  • message
  • └ result_code
  • String
  • code
  • └ result_success
  • Boolean
  • false
  • 是否成功
prize_id String 2280001 权益id
right_id String 1107261 奖品id
ext_attribute String {"template_name":"红包","amount":"500","condition":"10000"} 扩展信息

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlibabaBenefitDrawRequest req = new AlibabaBenefitDrawRequest();
req.setEname("82a36d90e6b5401c86623bf579a67b88");
req.setAppName("promotioncenter-3000000002037004");
req.setIp("127.0.0.1");
AlibabaBenefitDrawResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());

响应示例

  • XML示例
  • JSON示例
<alibaba_benefit_draw_response>
    <result>
        <result_msg>抽奖成功</result_msg>
        <result_code></result_code>
        <result_success>false</result_success>
    </result>
    <prize_id>2280001</prize_id>
    <right_id>1107261</right_id>
    <ext_attribute>{&quot;template_name&quot;:&quot;红包&quot;,&quot;amount&quot;:&quot;500&quot;,&quot;condition&quot;:&quot;10000&quot;}</ext_attribute>
</alibaba_benefit_draw_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

返回
顶部