Initiate Battle

Feature Description

The app admin can create battle through this API.

API Call Description

Request URL Sample:

https://xxxxxx/v4/live_engine_http_pk/create_battle?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json

Description Of Request Parameters

The table below only lists the parameters modified when this interface is called. For more details on other parameters, please refer to RESTful API Overview.
Parameters
Description
xxxxxx
The exclusive domain name corresponding to the country/region of SDKAppID:
China: console.tim.qq.com`
Singapore: adminapisgp.im.qcloud.com
v4/live_engine_http_pk/create_battle
Request API
sdkappid
The SDKAppID assigned by the Chat console when creating an application
identifier
Must be an App admin account. For more details, see App Administrator
usersig
Signatures generated by the App admin account. For specific operations, see Generate UserSig
random
Please enter a random 32-bit unsigned integer, value range 0 - 4294967295
contenttype
The request format has a fixed value of `JSON`.

Maximum Call Frequency

200 times/second.

Request Packet Sample

Basic form
{
"FromRoomId":"pk-1", //Caller's room ID in PK
"ToRoomIdList":["pk-2","pk-3"], //List of callee's room IDs in PK
"Duration":60000, //Duration of PK
"ExtensionInfo":"extension pk"
}

Request Packet Field Description

Field
Type
Attribute
Description
FromRoomId
String
Required
Caller's room ID in PK
ToRoomIdList
String
Required
List of callee room IDs in PK
Duration
Integer
Required
PK Duration
ExtensionInfo
String
Optional
PK Information Extension Field
Note:
When initiating a PK, the business side needs to confirm that the room on the device is in a connecting line. When initiating a PK, the room owners participating in the PK will be notified.

Response Packet Body Sample:

Basic form
{
"ErrorCode": 0,
"ErrorInfo": "",
"ActionStatus": "OK",
"RequestId": "requestId-123-456",
"Response":{
"BattleId": "battleid1",
"Result": [
{
"RoomId": "pk-2",
// 0 indicates initiate successfully
// 3 indicates that it is already in another PK.
// 5 System error

"ResultCode": 0,
"ResultMessage": "",
},
{
"RoomId": "pk-3",
"ResultCode": 0,
"ResultMessage": "",
}
],
}
}


Response Packet Field Description

Field
Type
Description
ErrorCode
Integer
Error code. 0 indicates success; non-zero indicates failure.
ErrorInfo
String
Error message.
ActionStatus
String
Result of request processing. OK indicates successful processing, FAIL indicates failure.
RequestId
String
Unique request ID, returned with each request, needed for troubleshooting.
BattleId
String
ID of this PK
Result
Array
PK situation of the callee
RoomId
String
Room ID
ResultCode
Integer
Result: 0 indicates success, 3 indicates being in PK, and 5 indicates a system error.
ResultMessage
String
PK Result Information

Error Code Description

Unless a network error occurs (such as a 502 error), the HTTP return code of this API is always 200. The real error code and error message are in the response packet body.Represented by `ErrorCode` and `ErrorInfo`.
Common Error Codes (60000 to 79999) refer to Error Code documentation.
The private error codes of this API are as follows:
Error Code
Description
100001
Server internal error, please retry.
100002
The parameter is illegal. Check whether the request is correct according to the error description.
100003
The Room ID already exists. Please select another Room ID.
100412
All called rooms are in PK. Please try again later.
100415
The caller is in PK. Please try again later.