群組匹配 API
這是用於在遊戲中匹配群組,例如熟人或朋友的API。
在提出匹配请求之前,兩個或更多的應用程式用戶必須創建一個群組
,並由群組代表進行匹配請求。
Note
Group API 只能在 Match Unit / Personnel
的 Match ID
設定為 Team
時使用。
創建群組
這是一個用於創建群組以邀請成員加入同一團隊的API。
- 請求的創建者成為小組領導(房間領導)。
- 在個人配對請求期間無法使用。
- 創建時會提供邀請熟人的進入代碼。
- 創建時,可以輸入分數信息以符合
匹配 ID
的規則。
請求 URL
實時 URL | https://api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/group |
沙盒 URL | https://sandbox-api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/group |
HTTP 方法 | POST |
內容類型 | application/json |
標頭參數
欄位名稱 | 描述 | 類型 | 是否必填 |
授權 | API 調用的身份驗證令牌 (Bearer) | 字串 | 是 |
路徑參數
欄位名稱 | 描述 | 類型 | 必填 |
gameIndex | 可以在 Hive 控制台應用中心檢查的專案識別碼 | int | 是 |
matchId | 在 Hive 控制台中創建的每個比賽的識別碼 | int | 是 |
請求主體
欄位名稱 | 描述 | 類型 | 必需 |
playerId | 帳號識別碼 | 長整數 | 是 |
point | 這是用於匹配的分數。輸入範圍為0 ~ 999,999,999 。如果未提供,將視為0 。 | 整數 | 否 |
extraData | 額外的帳號資訊(暱稱、等級、國家等)。最多可以輸入256個字元。將包含在匹配結果中。 | 字串 | 否 |
回應
請求範例
curl --location 'http://sandbox-api-match.withhive.com/gameindexes/2/matchmakings/1/group' --header 'Content-Type: application/json' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNzAyNDU4MTkzLCJqdGkiOiIxMzY2NDk4MjcxIn0.VSwvsTE-tS0sL_e9p9gNvHRkMCbsycSO4ObE4J2ya3a' --data '{"playerId":1}'
回應範例
{
"groupCode": "0343322",
"matchInfo": {
"gameIndex": 2,
"matchId": 1
},
"ownerPlayerId": 1,
"memberInfos": [
{
"playerId": 1
}
],
"requestingStatus": "notRequested"
}
加入群組
這是應用程式用戶在希望加入一個群組時,使用從群組領導者(房間領導者)那裡收到的代碼(groupCode
)來參加該群組的 API。
請求 URL
實時網址 | https://api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/groups/code/{code}/member |
沙盒網址 | https://sandbox-api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/groups/code/{code}/member |
HTTP 方法 | POST |
標頭參數
欄位名稱 | 描述 | 類型 | 必填 |
授權 | API 呼叫的身份驗證令牌 (Bearer) | 字串 | 是 |
路徑參數
欄位名稱 | 描述 | 類型 | 必填 |
gameIndex | 可以在 Hive 控制台應用程式中心檢查的專案識別碼 | int | 是 |
matchId | 在 Hive 控制台中創建的每場比賽的識別碼 | int | 是 |
code | 在群組創建 API 的回應中收到的 groupCode 值 | string | 是 |
請求主體
欄位名稱 | 描述 | 類型 | 必填 |
playerId | 帳戶識別碼 | 長整數 | 是 |
point | 這是用於匹配的分數。輸入範圍為0 ~ 999,999,999 。如果未輸入,將視為0 。 | 整數 | 否 |
extraData | 額外的帳戶信息(暱稱、等級、國家等)。最多可以輸入256個字符。它將包含在匹配結果中。 | 字串 | 否 |
回應
請求範例
curl --location 'http://sandbox-api-match.withhive.com/gameindexes/2/matchmakings/1/groups/code/0343322/member' --header 'Content-Type: application/json' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNzAyNDU4MTkzLCJqdGkiOiIxMzY2NDk4MjcxIn0.VSwvsTE-tS0sL_e9p9gNvHRkMCbsycSO4ObE4J2ya3a' --data '{"playerId":2}'
回應範例
{
"groupCode": "0343322",
"matchInfo": {
"gameIndex": 2,
"matchId": 1
},
"ownerPlayerId": 1,
"memberInfo": [
{
"playerId": 1
},
{
"playerId": 2
}
],
"requestingStatus": "notRequested"
}
離開群組
這是當您想要離開當前所在的群組時使用的 API。如果群組領導者(房間領導者)離開,剩下的成員之一將成為下一個群組領導者。
如果沒有剩餘的成員,該群組將被移除。
請求 URL
實時 URL | https://api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/players/{playerId}/group |
沙盒 URL | https://sandbox-api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/players/{playerId}/group |
HTTP 方法 | DELETE |
標頭參數
欄位名稱 | 描述 | 類型 | 必填 |
授權 | API 呼叫的身份驗證令牌 (Bearer) | 字串 | 是 |
路徑參數
字段名称 | 描述 | 类型 | 必需 |
gameIndex | 在 Hive 控制台应用中心可用的项目标识符 | int | 是 |
matchId | 在 Hive 控制台中创建的每场比赛的标识符 | int | 是 |
playerId | 用户 ID | long | 是 |
回應
在200 OK
的情況下,主體是空的。
請求範例
curl --location --request DELETE 'http://sandbox-api-match.withhive.com/gameindexes/2/matchmakings/1/players/2/group' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNzAyNDU4MTkzLCJqdGkiOiIxMzY2NDk4MjcxIn0.VSwvsTE-tS0sL_e9p9gNvHRkMCbsycSO4ObE4J2ya3a'
回應範例
正常處理時沒有特殊的回應內容。
群組強制驅逐 (踢出)
這是一個允許小組領導者(房間領導者)強行驅逐特定成員的API。
請求 URL
實時 URL | https://api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/players/{playerId}/group/members/{targetPlayerId} |
沙盒 URL | https://sandbox-api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/players/{playerId}/group/members/{targetPlayerId} |
HTTP 方法 | DELETE |
標頭參數
欄位名稱 | 描述 | 類型 | 必填 |
授權 | API 呼叫的身份驗證令牌 (Bearer) | 字串 | 是 |
路徑參數
欄位名稱 | 描述 | 類型 | 必填 |
gameIndex | 可以在 Hive 控制台應用中心檢查的專案識別碼 | int | 是 |
matchId | 在 Hive 控制台中創建的每場比賽的識別碼 | int | 是 |
playerId | 用戶 ID | long | 是 |
targetPlayerId | 要強制移除的成員 ID | long | 是 |
回應
這是群組創建API的結果數據格式。只有被強制移除的成員信息(memberInfos
)中的信息將被移除。
請求範例
curl --location --request DELETE 'http://sandbox-api-match.withhive.com/gameindexes/2/matchmakings/1/players/1/group/members/2' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNzAyNDU4MTkzLCJqdGkiOiIxMzY2NDk4MjcxIn0.VSwvsTE-tS0sL_e9p9gNvHRkMCbsycSO4ObE4J2ya3a'
回應範例
{
"groupCode": "0343322",
"matchInfo": {
"gameIndex": 2,
"matchId": 1
},
"ownerPlayerId": 1,
"memberInfo": [
{
"playerId": 1
}
],
"requestingStatus": "notRequested"
}
群組資訊檢索(基於群組成員)
這是一個在請求時檢索應用程式使用者所屬群組資訊的API。它可以用於各種目的,並且需要定期通過輪詢進行檢查。
通常用於以下目的。
- 檢查加入該群組的應用程式使用者列表
- 檢查匹配請求後的匹配結果
請求 URL
實時 URL | https://api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/players/{playerId}/group |
沙盒 URL | https://sandbox-api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/players/{playerId}/group |
HTTP 方法 | GET |
標頭參數
欄位名稱 | 描述 | 類型 | 必填 |
授權 | API 呼叫的身份驗證令牌 (Bearer) | 字串 | 是 |
路徑參數
欄位名稱 | 描述 | 類型 | 必填 |
gameIndex | 可以在 Hive 控制台應用中心找到的專案識別碼 | int | 是 |
matchId | 在 Hive 控制台中創建的每場比賽的識別碼 | int | 是 |
playerId | 用戶 ID | long | 是 |
回應
請求範例
curl --location 'http://sandbox-api-match.withhive.com/gameindexes/2/matchmakings/1/players/1/group' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNzAyNDU4MTkzLCJqdGkiOiIxMzY2NDk4MjcxIn0.VSwvsTE-tS0sL_e9p9gNvHRkMCbsycSO4ObE4J2ya3a'
回應範例
// 매칭 요청 전
{
"groupCode": "0343322",
"matchInfo": {
"gameIndex": 2,
"matchId": 1
},
"ownerPlayerId": 1,
"memberInfo": [
{
"playerId": 1
}
],
"requestingStatus": "notRequested"
}
// 매칭이 성사된 이후 (2:2 팀전)
{
"groupCode": "3683207",
"matchInfo": {
"gameIndex": 2,
"matchId": 1
},
"ownerPlayerId": 1,
"memberInfo": [
{
"playerId": 1,
"ready": true
},
{
"playerId": 2,
"ready": true
}
],
"matchingInfo": {
"status": "matched",
"matchingId": "2:1_2024-12-18T06:55:19.91_1",
"teamInfos": [
{
"teamIndex": 0,
"playerInfos": [
{
"playerId": 4,
"point": 50,
"extraData": "bbb"
},
{
"playerId": 3,
"extraData": "aaa"
}
]
},
{
"teamIndex": 1,
"playerInfos": [
{
"playerId": 1,
"extraData": "extra1"
},
{
"playerId": 2,
"point": 250,
"extraData": "aaa"
}
]
}
]
},
"requestingStatus": "requested",
"requestingInfo": {
"requestTimeUtc": "2024-12-18T06:55:19.17"
}
}
// 매칭 시간이 초과된 경우(timeout)
{
"groupCode": "0400606",
"matchInfo": {
"gameIndex": 2,
"matchId": 1
},
"ownerPlayerId": 1,
"memberInfo": [
{
"playerId": 1,
"ready": true
},
{
"playerId": 2,
"ready": true
}
],
"matchingInfo": {
"status": "timeout"
},
"requestingStatus": "requested",
"requestingInfo": {
"requestTimeUtc": "2024-12-20T06:37:47.99"
}
}
群組資訊檢索(按代碼)
這是一個使用群組領導者(房間領導者)提供的代碼(groupCode
)來檢查群組是否存在的API。
請求 URL
實時 URL | https://api-match.withhive.com/gameindexes/{gameIndex}/groups |
沙盒 URL | https://sandbox-api-match.withhive.com/gameindexes/{gameIndex}/groups |
HTTP 方法 | GET |
標頭參數
欄位名稱 | 描述 | 類型 | 必填 |
授權 | API 調用的身份驗證令牌 (Bearer) | 字串 | 是 |
路徑參數
字段名稱 | 描述 | 類型 | 是否必填 |
gameIndex | 可以在Hive控制台應用中心檢查的項目識別碼 | int | 是 |
查詢參數
欄位名稱 | 描述 | 類型 | 必填 |
代碼 | 群組代碼 (groupCode) | 字串 | 是 |
回應
欄位名稱 | 描述 | 類型 |
groupCode | 進入小組所需的代碼 | 字串 |
ownerPlayerId | 小組擁有者(主持人)的識別碼 | 長整數 |
matchInfo | 有關小組所屬的 gameIndex 和 matchId 的資訊 | 物件 |
請求範例
curl --location 'http://sandbox-api-match.withhive.com/gameindexes/2/groups?code=0343322' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNzAyNDU4MTkzLCJqdGkiOiIxMzY2NDk4MjcxIn0.VSwvsTE-tS0sL_e9p9gNvHRkMCbsycSO4ObE4J2ya3a'
回應範例
{
"groupCode": "0343322",
"matchInfo": {
"gameIndex": 2,
"matchId": 1
},
"ownerPlayerId": 1
}
會員資訊更新
當一個屬於某個群組的成員想要更改他們的資訊時,使用的API如下。可以更改的資訊如下。
- 準備狀態 (
ready
) - 群組領導者(房間領導者)是一個未使用的項目。\n - 分數 (
point
)\n - 附加信息 (
extraData
)
請求 URL
實時 URL | https://api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/players/{playerId}/group/memberinfo |
沙盒 URL | https://sandbox-api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/players/{playerId}/group/memberinfo |
HTTP 方法 | PATCH |
內容類型 | application/json |
標頭參數
欄位名稱 | 描述 | 類型 | 必填 |
授權 | API 調用的身份驗證令牌 (Bearer) | 字串 | 是 |
路徑參數
欄位名稱 | 描述 | 類型 | 必填 |
gameIndex | 可以在 Hive 控制台應用中心檢查的專案識別碼 | int | 是 |
matchId | 在 Hive 控制台中創建的每個比賽識別碼 | int | 是 |
playerId | 用戶 ID | long | 是 |
請求主體
欄位名稱 | 描述 | 類型 | 必填 |
ready | 準備狀態 | 布林值 | 是 |
point | 這是用於匹配的分數。輸入範圍為0 ~ 999,999,999 。如果未輸入,將視為0 。 | 整數 | 否 |
extraData | 額外的帳戶信息(暱稱、等級、國家等)。最多可以輸入256個字符。它將包含在匹配結果中。 | 字串 | 否 |
回應
請求範例
curl --location --request PATCH 'http://sandbox-api-match.withhive.com/gameindexes/2/matchmakings/1/players/2/group/memberinfo' --header 'Content-Type: application/json' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNzAyNDU4MTkzLCJqdGkiOiIxMzY2NDk4MjcxIn0.VSwvsTE-tS0sL_e9p9gNvHRkMCbsycSO4ObE4J2ya3a' --data '{"ready":false,"point":0,"extraData":""}'
回應範例
{
"groupCode": "0343322",
"matchInfo": {
"gameIndex": 2,
"matchId": 1
},
"ownerPlayerId": 1,
"memberInfo": [
{
"playerId": 1
}
],
"requestingStatus": "notRequested"
}
匹配請求
這是每個組開始匹配所請求的API。
- 您必須在控制台中提前創建與
matchId
相對應的比賽。(與個人匹配請求相同) - 在請求時必須至少有 2 名成員。
- 不是小組領導者(房間領導者)的成員必須將其“準備狀態”(Ready)設置為
true
。 - 如果有正在進行的比賽,必須在提出請求之前組織(刪除)它。
- 只有小組代表(房間領導者)可以提出請求。
請求 URL
實時 URL | https://api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/group/request |
沙盒 URL | https://sandbox-api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/group/request |
HTTP 方法 | POST |
內容類型 | application/json |
標頭參數
欄位名稱 | 描述 | 類型 | 必填 |
授權 | API 呼叫的身份驗證令牌 (Bearer) | 字串 | 是 |
路徑參數
欄位名稱 | 描述 | 類型 | 必填 |
gameIndex | 可以在 Hive 控制台應用中心檢查的專案識別碼 | int | 是 |
matchId | 在 Hive 控制台中創建的每個比賽的識別碼 | int | 是 |
請求主體
欄位名稱 | 描述 | 類型 | 必填 |
playerId | 帳戶識別碼 | 長整數 | 是 |
回應
請求範例
curl --location 'http://sandbox-api-match.withhive.com/gameindexes/2/matchmakings/1/group/request' --header 'Content-Type: application/json' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNzAyNDU4MTkzLCJqdGkiOiIxMzY2NDk4MjcxIn0.VSwvsTE-tS0sL_e9p9gNvHRkMCbsycSO4ObE4J2ya3a' --data '{"playerId":1}'
回應範例
{
"groupCode": "0343322",
"matchInfo": {
"gameIndex": 2,
"matchId": 1
},
"ownerPlayerId": 1,
"memberInfo": [
{
"playerId": 1
},
{
"playerId": 2,
"ready": true
}
],
"matchingInfo": {
"status": "matchingInProgress"
},
"requestingStatus": "requested",
"requestingInfo": {
"requestTimeUtc": "2024-12-05T07:35:35.15"
}
}
取消匹配請求
請求 URL
實時 URL | https://api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/group/request |
沙盒 URL | https://sandbox-api-match.withhive.com/gameindexes/{gameIndex}/matchmakings/{matchId}/group/request |
HTTP 方法 | DELETE |
標頭參數
欄位名稱 | 描述 | 類型 | 必需 |
授權 | API 調用的身份驗證令牌 (Bearer) | 字串 | 是 |
路徑參數
欄位名稱 | 描述 | 類型 | 必填 |
gameIndex | 可以在 Hive 控制台應用中心檢查的專案識別碼 | int | 是 |
matchId | 在 Hive 控制台中創建的每個比賽識別碼 | int | 是 |
請求主體
欄位名稱 | 描述 | 類型 | 必填 |
playerId | 帳戶識別碼 | 長整數 | 是 |
回應
請求範例
curl --location --request DELETE 'https://sandbox-api-match.withhive.com/gameindexes/2/matchmakings/1/group/request' --header 'Content-Type: application/json' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNzAyNDU4MTkzLCJqdGkiOiIxMzY2NDk4MjcxIn0.VSwvsTE-tS0sL_e9p9gNvHRkMCbsycSO4ObE4J2ya3a' --data '{"playerId":3}'
回應範例
{
"groupCode": "0343322",
"matchInfo": {
"gameIndex": 2,
"matchId": 1
},
"ownerPlayerId": 1,
"memberInfo": [
{
"playerId": 1
},
{
"playerId": 2
}
],
"requestingStatus": "notRequested"
}
公共回應
這是有關群組的 API 回應中常用欄位的描述。
memberInfos
有關屬於該小組的成員(包括小組領導或房間領導)的信息字段如下。
欄位名稱 | 描述 | 類型 |
playerId | 帳戶識別碼 | long |
ready | 準備狀態 | boolean |
point | 加入(更新)群組時輸入的分數 | integer |
extraData | 加入(更新)群組時輸入的附加信息 | string |
matchInfo
包含gameIndex
和matchId
信息的字段,属于该组的如下。
欄位名稱 | 描述 | 類型 |
gameIndex | 控制台的 App Center 中註冊的專案的 遊戲索引 值 | 整數 |
matchId | 控制台的 配對 中註冊的 比賽 ID | 整數 |
requestingStatus
與匹配請求狀態字段相對應的值如下。
notRequested
: 未請求匹配 requested
: 已請求匹配
requestingInfo
這是匹配請求信息字段。
欄位名稱 | 描述 | 類型 |
requestTimeUtc | 基於 UTC+0 的請求時間 | 字串 |
matchingInfo
包含匹配進度信息的字段如下。
matchingInfo → status
與匹配進度信息中的狀態字段相對應的值如下。
matchingInProgress
: 匹配進行中 timeout
: 在時間限制內未找到匹配 matched
: 匹配成功
matchingInfo → privateInfos
構成個人配對應用程式用戶信息的配對進度信息的字段如下。它與matchingInfo → teamInfos → playerInfos的數據格式相同。
字段名稱 | 描述 | 類型 |
playerId | 帳戶識別碼。如果為0,則需要作為機器人處理 | long |
point | 加入(更新)群組時輸入的分數 | integer |
extraData | 加入(更新)群組時輸入的附加信息 | string |
matchingInfo → teamInfos
組成團隊資訊的欄位在匹配進度資訊的群組匹配中匹配如下。
欄位名稱 | 描述 | 類型 |
teamIndex | 用於區分團隊的值,從 0 開始 | 整數 |
playerInfos | 關於屬於該團隊的應用用戶的信息 | 陣列 |
matchingInfo → teamInfos → playerInfos
配置應用程式用戶資訊的字段,與匹配進度中的團隊匹配如下。
它與 matchingInfo → privateInfos 的數據格式相同。
欄位名稱 | 描述 | 類型 |
playerId | 帳戶識別碼。如果為0,則需要作為機器人處理 | long |
point | 加入(更新)群組時輸入的分數 | integer |
extraData | 加入(更新)群組時輸入的附加信息 | string |