Modify Task Reward Activity
Updated: 2026-02-27 09:38:24
Interface Description
1、修改任务奖励活动
2、接口支持https协议
Interface URL
https://api.polyv.net/live/v4/channel/task-reward-activity/update
Request Method
POST
Interface Constraints
- The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls have frequency limits. See details
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details on obtaining keys |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be stored or used directly on the client. All APIs must be called through the customer's own server to relay requests to the POLYV server to obtain response data. See signature generation rules |
Request Body Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | Integer | Channel ID |
| activityId | true | Long | Activity ID |
| activityName | false | String | Activity name, maximum length 64 characters |
| taskRule | false | Integer | Task rule: 1: Unlock tasks, 2: Parallel tasks |
| startTime | false | Long | Activity start time |
| endTime | false | Long | Activity end time |
| tasks | true | Array | Task rule list See tasks field description |
tasks Parameter Description
| Parameter | Required | Description | Type |
|---|---|---|---|
| sort | true | Sort order | Integer |
| reachCondition | true | Condition settings See reachCondition | Object |
| rewardSetting | true | Reward settings See rewardSetting | Object |
reachCondition Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| type | true | String | Condition type (sign: check-in, online: online duration, questionnaire: quiz, custom: custom) |
| amount | true | Integer | Target value |
| templateId | false | Long | Question ID, required when condition type is questionnaire |
| customEvent | false | String | Custom task event, required when condition type is custom |
| customEventName | false | String | Custom task name |
| customIcon | false | String | Custom task icon |
| customUnit | false | String | Custom task unit |
| customButtonText | false | String | Custom task button text |
| customReachText | false | String | Custom task completion text, e.g.: {customEventName} completed: {amount}{customUnit} |
rewardSetting Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| type | true | String | cash: cash, custom: custom, nothing: no reward, externalPoint: external points |
| amount | false | Integer | Reward value (when type is cash, the unit is cents; required when type is cash or externalPoint) |
| limit | false | Integer | Reward limit share (-1 means unlimited) |
| customReward | false | String | Custom reward content, optional |
Example
https://api.polyv.net/live/v4/channel/task-reward-activity/update?appId=frlr1zazn3&sign=012332FBD8DBCFC068AFCB484A2ADECB×tamp=1670550787318
Request body JSON parameters:
{
"activityId": 5,
"channelId": 4854808,
"activityName": "修改测试活动",
"activityMode": 1,
"taskRule": 1,
"startTime": 1717569984074,
"endTime": 1717569994074,
"tasks": [
{
"reachCondition": {
"type": "sign",
"amount": 11
},
"rewardSetting": {
"type": "cash",
"amount": 10,
"limit": 10
}
},
{
"reachCondition": {
"type": "sign",
"amount": 21
},
"rewardSetting": {
"type": "cash",
"amount": 10,
"limit": 10
}
}
]
}
Response body JSON:
{
"code": 200,
"status": "success",
"requestId": "e9eb12f0-5d55-482a-8a47-62863d04772c",
"data": true,
"success": true
}
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code, 200 for success, non-200 for failure |
| status | String | Response result, determined by business logic, success returns success, failure returns error |
| success | Boolean | Response result, determined by business logic, success returns true, failure returns false |
| data | Boolean | Whether the task reward activity was modified successfully |
| error | Object | Error information when status code is non-200 See Error field description |
| requestId | String | Request ID, a unique UUID generated for each request, only for troubleshooting and debugging, should not be tied to business logic |
Error Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to determine the specific error cause |
| desc | String | Error description, corresponds to error.code |
Java Request Example
For quick integration of basic code, download the relevant dependency source code, click here to download the source code. After downloading, add it to your own source code project. HttpUtil.java and LiveSignUtil.java in the test cases are included in the downloaded file.
It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private final Logger log = LoggerFactory.getLogger(getClass());
/**
* 修改任务奖励活动
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void createTaskRewardTest() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
String url = "https://api.polyv.net/live/v4/channel/task-reward-activity/update";
//业务参数
Integer channelId = 5004544;
String activityId = 1134;
String activityName = "demoData";
Integer taskRule = 1;
Long startTime = 1722035312584;
Long endTime = 1722036312584;
List<Task> tasks = new ArrayList();
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("channelId", channelId);
jsonMap.put("activityId", activityId);
jsonMap.put("activityName", activityName);
jsonMap.put("taskRule", taskRule);
jsonMap.put("startTime", startTime);
jsonMap.put("endTime", endTime);
jsonMap.put("tasks", tasks);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, JSON.toJSONString(jsonMap), null);
log.info("测试修改活动结果:{}", response);
//do somethings
}
Response Example
For global system error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"requestId": "e9eb12f0-5d55-482a-8a47-62863d04772c",
"data": true,
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
