> ## 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}/recentplayers/server

> Post Server Recent Players

# Post Server Recent Players

追加或更新一组用户的最近玩家列表(单向)。本质上是客户端 API 的批处理 API,面向服务器。

此 API 允许游戏服务器追加一组用户的最近玩家列表,并更新现有的最近玩家条目。每个用户的最近玩家列表是单向的。

```http theme={null}
POST /titles/{titleId}/recentplayers/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 |

## 请求正文

| 名称 | 是否必需 | 类型 | 说明 |
| - | - | - | - |
| recentPlayersByXuid | TRUE | [ServerRecentPlayersByXuid](#serverrecentplayersbyxuid)\[] | 表示 XUID 及其最近玩家的对象数组。至少应有 1 个,最多 20 个 XUID 条目。 |

## 响应

| 名称 | 类型 | 说明 |
| - | - | - |
| 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 |

## 定义

* [EncounterType](#encountertype)
* [ErrorResponse](#errorresponse)
* [Network](#network)
* [ServerRecentPlayersByXuid](#serverrecentplayersbyxuid)
* [ServerRecentPlayersRequest](#serverrecentplayersrequest)
* [ThrottledEntity](#throttledentity)
* [UnidirectionalRecentPlayer](#unidirectionalrecentplayer)

### EncounterType

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

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

### ErrorResponse

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

### Network

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

### ServerRecentPlayersByXuid

| 名称 | 类型 | 说明 |
| - | - | - |
| recentPlayers | [UnidirectionalRecentPlayer](#unidirectionalrecentplayer)\[] | 此用户的最近玩家数组。至少应有 1 名最近玩家,最多 100 名最近玩家。 |
| xuid | string | 用户的 XUID(十进制整数)。 |

### ServerRecentPlayersRequest

| 名称 | 类型 | 说明 |
| - | - | - |
| recentPlayersByXuid | [ServerRecentPlayersByXuid](#serverrecentplayersbyxuid)\[] | 表示 XUID 及其最近玩家的对象数组。至少应有 1 个,最多 20 个 XUID 条目。 |

### ThrottledEntity

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

## UnidirectionalRecentPlayer

| 名称 | 类型 | 说明 |
| - | - | - |
| encounterType | [EncounterType](#encountertype) | 最近玩家遭遇的类型。此字段是可选的,默认为 Default。Default 没有规定含义 —— 由调用方决定如何适当地解释此值。 |
| id | string | 另一位用户的 ID(十进制 XUID 整数)。 |
| network | [Network](#network) | 遇见另一位用户所在的网络。 |
| timestamp | 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)
