保利威文档中心

帮助中心

创建抽奖活动

更新时间:2026-04-09 14:17:35

接口描述

1、创建抽奖活动
2、接口支持https协议

接口URL

http://api.polyv.net/live/v4/channel/lottery-activity/create

请求方式

POST

接口约束

1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看 2、若参数不正确则会响应400异常

请求参数描述

参数名 必选 类型 说明
appId true String 账号appId【详见获取密钥
timestamp true Long 当前13位毫秒级时间戳,3分钟内有效
sign true String 签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则
channelId true Integer 频道号

请求体参数描述

参数名 必选 类型 说明
activityName true String 抽奖活动名称
lotteryCondition true String 抽奖活动类型, none:无条件, invite:邀请好友, duration:观看时长, comment:评论抽奖, question:答题抽奖
amount true Integer 中奖人数
hiddenWinnerAmount false String 是否隐藏中奖人数, 值:Y/N, 默认N
lotteryRange false String 参与抽奖用户类型: all:全部,customGroup:自定义分组
customGroupIds false Array 自定义分组ID, 抽奖用户类型为自定义时有效
customGroupLotteryType false String 分组抽取方式, average:等额抽奖, random:随机抽奖
customGroupLotteryAmount false Integer 每组抽取数量
hiddenAttendeeNumber false String 是否隐藏参与人数, 值:Y/N, 默认N
repeatWinEnabled false String 允许重复中奖, 值:Y/N, 默认N
receiveEnabled false String 是否填写收货信息, 值:Y/N, 默认N
receiveInfo false Array 收货字段信息列表,无条件抽奖时填写【详见ReceiveInfo
prizeName true String 奖品名称
thumbnail false String 奖品图片
activityDuration false String 活动时长,非无条件抽奖时必填
activityDurationType false String 活动时长单位(second,minute,hour),默认minute,second只有lotteryCondition为none时支持
inviteType false String 邀请方式,poster:邀请海报,external:外部邀请,邀请抽奖时必填
externalListLink false String 外部名单链接,邀请抽奖且邀请方式为外部邀请时必填
externalInviteNumLink false String 获取邀请人数链接,邀请抽奖且邀请方式为外部邀请时必填
inviteNum false Integer 邀请人数,邀请抽奖时必填
duration false Integer 观看时长,观看时长抽奖时必填
comment false String 评论内容,评论抽奖时必填
acceptType false String 领奖方式,form:表单,link:外链,qrCode:识别二维码, 非无条件和答题抽奖必填
formInfo false Array 领奖方式表单字段信息, 领奖方式为表单填写 【详见ReceiveInfo
prizeUrl false String 领奖方式奖品链接, 领奖方式为外链必填
qrCode false String 领奖方式二维码链接, 领奖方式为二维码必填
qrCodeTips false String 领奖方式二维码提示语, 领奖方式为二维码填写
realPrice false BigDecimal 优惠价格
price false BigDecimal 奖品原价
prizeInfo false Array 奖品信息,答题抽奖时必填 【详见PrizeInfo
questionGroupId false Long 问答组模板ID, 答题抽奖必填
perAnswerDuration false Integer 每道题的答题时长, 答题抽奖必填
lotteryOnlineEnabled false String 开奖时观众需在线, 值:Y/N, 默认Y(无条件分组抽奖时设置生效)
answerType false String 答题抽奖,答题方式,pushQuestion:边推边答, autonomyAnswer:自主答题,默认:pushQuestion
showWinnerCode false String 是否展示兑奖码,默认开, 值:Y/N, 默认Y
showWinners false String 是否展示中奖名单,默认开, 值:Y/N, 默认Y

ReceiveInfo参数描述

参数名 必选 类型 说明
type false String 类型, userName:姓名、userPhone:手机号、custom:自定义
field true String 字段名
tips true String 提示语
required false Boolean 是否必填,true/false

PrizeInfo参数描述

参数名 必选 类型 说明
prizeItem true String 奖项名称
correctAnswerCount true Integer 答对题目数
prizeName true String 奖品名称
thumbnail false String 奖品图片
realPrice false BigDecimal 优惠价格
price false BigDecimal 奖品原价
acceptType true String 领奖方式,form:表单,link:外链,qrCode:识别二维码
formInfo false Array 领奖方式表单字段信息, 领奖方式为表单填写 【详见ReceiveInfo
prizeUrl false String 领奖方式奖品链接, 领奖方式为外链必填
qrCode false String 领奖方式二维码链接, 领奖方式为二维码必填
qrCodeTips false String 领奖方式二维码提示语, 领奖方式为二维码填写
amount true Integer 中奖人数
hiddenWinnerAmount false String 是否隐藏中奖人数, 值:Y/N, 默认N

示例

http://api.polyv.net/live//v4/channel/lottery-activity/create?appId=frlr1zazn3&timestamp=1665629374000&sign=6CFA3141718E1AF0155889EEA2988206&channelId=2974342

请求体json参数:

{
    "activityName": "无条件抽奖",
    "lotteryCondition": "none",
    "amount": 1,
    "receiveEnabled": "Y",
    "prizeName": "键盘",
    "receiveInfo": [{
        "field": "姓名",
        "tips": "请输入您的名称",
        "type": "userName",
        "required": true
    }, {
        "field": "手机",
        "tips": "请输入您的手机号码",
        "type": "userPhone",
        "required": true
    }],
    "lotteryRange": "all"
}

响应描述

参数名 类型 说明
code Integer 状态码,与 http 状态码相同,用于确定基本的响应状态
status String 响应结果,由业务决定,成功返回success,失败返回error
success Boolean 是否成功响应
requestId String 请求ID,每次请求生成的唯一的 UUID,仅可用于排查、调试,不应该和业务挂上钩
error Object 状态码非200时的错误信息【详见Error字段描述
data Object 响应详细信息【详见data字段说明

Error响应描述

参数名 类型 说明
code Integer 错误代码,用于确定具体的错误原因
desc String 错误描述,与 error.code 对应

data响应描述

参数名 类型 说明
id Long 抽奖活动ID
activityName String 抽奖活动名称
lotteryCondition String 抽奖类型
status String 抽奖活动状态
amount Integer 中奖人数
hiddenWinnerAmount String 是否隐藏中奖人数
lotteryRange String 参与抽奖用户类型: all:全部,customGroup:自定义分组
customGroup Array 自定义分组信息【详见CustomGroup
customGroupLotteryType String 分组抽取方式, average:等额抽奖, random:随机抽奖
customGroupLotteryAmount Integer 每组抽取数量
hiddenAttendeeNumber String 是否隐藏参与人数
repeatWinEnabled String 允许重复中奖
receiveEnabled String 是否填写收货信息
receiveInfo Array 收货字段信息列表,无条件抽奖时填写【详见ReceiveInfo
prizeName String 奖品名称
thumbnail String 奖品图片
activityDuration String 活动时长(分钟)
inviteType String 邀请方式
externalListLink String 外部名单链接
externalInviteNumLink String 获取邀请人数链接
inviteNum Integer 邀请人数
duration Integer 观看时长
comment String 评论内容
acceptType String 领奖方式,form:表单,link:外链,qrCode:识别二维码,
formInfo Array 领奖方式表单字段信息 【详见ReceiveInfo
prizeUrl String 领奖方式奖品链接
qrCode String 领奖方式二维码链接
qrCodeTips String 领奖方式二维码提示语
realPrice BigDecimal 优惠价格
price BigDecimal 奖品原价
prizeInfo Array 奖品信息 【详见PrizeInfo
questionGroupId Long 问答组模板ID
perAnswerDuration Integer 每道题的答题时长

CustomGroup响应描述

参数名 类型 说明
id Long 分组ID
title String 分组标题
type String 分组类型
count String 分组人数

ReceiveInfo响应描述

参数名 类型 说明
type String 类型, userName:姓名、userPhone:手机号、custom:自定义
field String 字段名
tips String 提示语
required Boolean 是否必填,true/false

PrizeInfo响应描述

参数名 类型 说明
prizeItem String 奖项名称
correctAnswerCount Integer 答对题目数
prizeName String 奖品名称
thumbnail String 奖品图片
realPrice BigDecimal 优惠价格
price BigDecimal 奖品原价
acceptType String 领奖方式,form:表单,link:外链,qrCode:识别二维码
formInfo Array 领奖方式表单字段信息 【详见ReceiveInfo
prizeUrl String 领奖方式奖品链接
qrCode String 领奖方式二维码链接
qrCodeTips String 领奖方式二维码提示语
amount Integer 中奖人数
hiddenWinnerAmount String 是否隐藏中奖人数

Java请求示例

快速接入基础代码请下载相关依赖源码点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下载文件中。

强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。


响应示例

系统全局错误说明详见全局错误说明

成功示例

{
    "code": 200,
    "status": "success",
    "requestId": "723ed01861804e9aa3dc1cf1aced83d5.72.17097790901718347",
    "data": {
        "id": 20521,
        "activityName": "无条件抽奖",
        "lotteryCondition": "none",
        "amount": 1,
        "receiveEnabled": "Y",
        "receiveInfo": [
            {
                "type": "userName",
                "field": "姓名",
                "tips": "请输入您的名称",
                "required": true
            },
            {
                "type": "userPhone",
                "field": "手机",
                "tips": "请输入您的手机号码",
                "required": true
            }
        ],
        "prizeName": "键盘",
        "activityDuration": null,
        "inviteType": "poster",
        "inviteNum": null,
        "duration": null,
        "comment": null,
        "externalListLink": null,
        "externalInviteNumLink": null,
        "acceptType": null,
        "formInfo": null,
        "prizeUrl": null,
        "qrCode": null,
        "qrCodeTips": null,
        "thumbnail": null,
        "realPrice": null,
        "price": null,
        "status": null,
        "prizeInfo": null,
        "questionGroupId": null,
        "perAnswerDuration": null,
        "lotteryRange": "all",
        "repeatWinEnabled": "N",
        "customGroup": [],
        "hiddenWinnerAmount": "N",
        "hiddenAttendeeNumber": "N",
        "customGroupLotteryType": "random",
        "customGroupLotteryAmount": null
    },
    "success": true
}

异常示例

{
    "code": 400,
    "status": "error",
    "requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
    "error": {
        "code": 20001,
        "desc": "application not found."
    },
    "success": false
}
联系客服,在线咨询