> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /titles/{titleId}/recentplayergroups/server

> Post Server Recent Player Group

# Post Server Recent Player Group

追加或更新一个组内所有用户的最近玩家(双向)。

此 API 允许游戏服务器追加一组用户的最近玩家列表,并更新现有的最近玩家条目。组内所有用户都会被添加到彼此的最近玩家列表中(双向)。

最近玩家组的示例:\[ \[A,B,C], \[A,D], \[E,F] ]。

A 遇见了 B、C 和 D。B 遇见了 A 和 C。D 只遇见了 A,以此类推。

```http theme={null}
POST /titles/{titleId}/recentplayergroups/server
```

## URI 参数

| 参数 | 位置 | 是否必需 | 类型 | 说明 |
| - | - | - | - | - |
| titleId | path | TRUE | integer | 发送请求所针对的游戏的 titleId。 |

## 请求标头

| 名称 | 是否必需 | 类型 | 说明 |
| - | - | - | - |
| Authorization | TRUE | integer | 调用方必须以 XBL 3.0 授权格式提供 XToken。例如,Authorization: XBL3.0 x=2553948354698;>encrypted token\<) |
| Content-Type | TRUE | string | ContentType 必须设置为 application/json |

## 请求正文

| 名称 | 是否必需 | 类型 | 说明 |
| - | - | - | - |
| recentPlayerGroups | TRUE | [RecentPlayerGroup](#recentplayergroup)\[] | 双向最近玩家组的数组。至少应有 1 个组,最多 20 个组。每组内至少应有 2 名玩家,最多 100 名玩家。 |

## 响应

| 名称 | 类型 | 说明 |
| - | - | - |
| 204 No Content | | 最近玩家请求已成功发送。 |
| 400 Bad Request | [ErrorResponse](#errorresponse) | 处理请求时发生错误。可能的错误代码:“RequestValidationError: The request validation has failed.”、“AuthorizationError: The caller is not allowed to access the resource.” |
| 其他状态代码 | [ThrottledEntity](#throttledentity) | 请求过多。标头 Retry-After: integer |

## 定义

* [BidirectionalRecentPlayer](#bidirectionalrecentplayer)
* [EncounterType](#encountertype)
* [ErrorResponse](#errorresponse)
* [Network](#network)
* [RecentPlayerGroup](#recentplayergroup)
* [ServerRecentPlayerGroupsRequest](#serverrecentplayergroupsrequest)
* [ThrottledEntity](#throttledentity)

### BidirectionalRecentPlayer

| 名称 | 类型 | 说明 |
| - | - | - |
| id | string | 另一位用户的 ID(十进制 XUID 整数)。 |
| network | [Network](#network) | 遇见另一位用户所在的网络。 |

### EncounterType

最近玩家遭遇的类型。此字段是可选的,默认为 Default。Default 没有规定含义 —— 由调用方决定如何适当地解释此值。

| 名称 | 类型 | 说明 |
| - | - | - |
| Default | string | |
| Opponent | string | |
| Teammate | string | |

### ErrorResponse

| 名称 | 类型 | 说明 |
| - | - | - |
| debugMessage | string | 可用于调试的、人类可读的错误消息版本。 |
| errorCode | string | 错误代码枚举。 |

### Network

| 名称 | 类型 | 说明 |
| - | - | - |
| XboxLive | string | |

### RecentPlayerGroup

组内所有用户在指定时间彼此相遇。每组必须包含至少 2 名、最多 100 名用户。

| 名称 | 类型 | 说明 |
| - | - | - |
| encounterType | [EncounterType](#encountertype) | 最近玩家遭遇的类型。此字段是可选的,默认为 Default。Default 没有规定含义 —— 由调用方决定如何适当地解释此值。 |
| recentPlayers | [BidirectionalRecentPlayer](#bidirectionalrecentplayer)\[] | |
| timestamp | string | |

### ServerRecentPlayerGroupsRequest

组内所有用户在指定时间彼此相遇。每组必须包含至少 2 名、最多 100 名用户。

| 名称 | 类型 | 说明 |
| - | - | - |
| recentPlayerGroups | [RecentPlayerGroup](#recentplayergroup) | 双向最近玩家组的数组。至少应有 1 个组,最多 20 个组。每组内至少应有 2 名玩家,最多 100 名玩家。 |

### ThrottledEntity

| 名称 | 类型 | 说明 |
| - | - | - |
| currentRequests | string | 当前请求数——并发或速率。 |
| debugMessage | string | 可用于调试的、人类可读的限流消息版本。 |
| limitType | string | 限制类型,即并发或速率。 |
| maxRequests | string | 允许的最大请求数——并发或速率。 |
| periodInSeconds | string | 超出速率或并发限制时适用的以秒为单位的时段。 |
| version | string | 当前限流合约版本。 |


## Related topics

- [TitleId Element (MicrosoftGame.config)](https://devdocs.xbox.com/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-titleid.md)
- [TitleId 요소(MicrosoftGame.config)](https://devdocs.xbox.com/ko/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-titleid.md)
- [TitleId 元素 (MicrosoftGame.config)](https://devdocs.xbox.com/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-titleid.md)
- [Élément MicrosoftGame.config - TitleId](https://devdocs.xbox.com/fr/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-titleid.md)
- [TitleId 要素 (MicrosoftGame.config)](https://devdocs.xbox.com/ja-jp/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-titleid.md)
