> ## 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.

# 張貼伺服器最近玩家

> 張貼伺服器最近玩家

# 張貼伺服器最近玩家

附加至或更新一組使用者的最近玩家清單 (單向)。這基本上是用戶端 API 供伺服器使用的批次 API。

此 API 可讓遊戲伺服器附加至一組使用者的最近玩家清單，並更新現有的最近玩家項目。每位使用者的最近玩家清單都是單向的。

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

<a id="uri-parameters" />

## URI 參數

| 參數 | 位置 | 必要 | 類型 | 描述 |
| - | - | - | - | - |
| titleId | path | TRUE | integer | 傳送要求的目標遊戲 titleId。 |

<a id="request-header" />

## 要求標頭

| 名稱 | 必要 | 類型 | 描述 |
| - | - | - | - |
| Authorization | TRUE | integer | 呼叫者必須以 XBL 3.0 授權格式提供 XToken。例如，Authorization: XBL3.0 x=2553948354698;>encrypted token\<) |
| Content-Type | TRUE | string | ContentType 必須設定為 application/json |

<a id="request-body" />

## 要求本文

| 名稱 | 必要 | 類型 | 描述 |
| - | - | - | - |
| recentPlayersByXuid | TRUE | [ServerRecentPlayersByXuid](#serverrecentplayersbyxuid)\[] | 代表 XUID 及其最近玩家的物件陣列。應至少有 1 個、最多 20 個 XUID 項目。 |

<a id="responses" />

## 回應

| 名稱 | 類型 | 描述 |
| - | - | - |
| 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 |

<a id="definitions" />

## 定義

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

<a id="encountertype" />

### EncounterType

最近玩家相遇的類型。此欄位為選擇性，預設為 Default。Default 沒有規定的意義，由呼叫者自行適當解讀此值。

| 名稱 | 類型 | 描述 |
| - | - | - |
| Default | string | |
| Opponent | string | |
| Teammate | string | |

<a id="errorresponse" />

### ErrorResponse

| 名稱 | 類型 | 描述 |
| - | - | - |
| debugMessage | string | 可用於偵錯的人類可讀錯誤訊息版本。 |
| errorCode | string | 錯誤碼列舉。 |

<a id="network" />

### Network

| 名稱 | 類型 | 描述 |
| - | - | - |
| XboxLive | string | |

<a id="serverrecentplayersbyxuid" />

### ServerRecentPlayersByXuid

| 名稱 | 類型 | 描述 |
| - | - | - |
| recentPlayers | [UnidirectionalRecentPlayer](#unidirectionalrecentplayer)\[] | 此使用者的最近玩家陣列。應至少有 1 位、最多 100 位最近玩家。 |
| xuid | string | 使用者的 XUID (十進位整數)。 |

<a id="serverrecentplayersrequest" />

### ServerRecentPlayersRequest

| 名稱 | 類型 | 描述 |
| - | - | - |
| recentPlayersByXuid | [ServerRecentPlayersByXuid](#serverrecentplayersbyxuid)\[] | 代表 XUID 及其最近玩家的物件陣列。應至少有 1 個、最多 20 個 XUID 項目。 |

<a id="throttleentity" />

### ThrottledEntity

| 名稱 | 類型 | 描述 |
| - | - | - |
| currentRequests | string | 目前的要求數 - 並行或速率。 |
| debugMessage | string | 可用於偵錯的人類可讀節流訊息版本。 |
| limitType | string | 限制類型，即並行或速率。 |
| maxRequests | string | 允許的最大要求數 - 並行或速率。 |
| periodInSeconds | string | 超過速率或並行限制時套用的期間 (以秒為單位)。 |
| version | string | 目前的節流合約版本。 |

<a id="unidirectionalrecentplayer" />

## UnidirectionalRecentPlayer

| 名稱 | 類型 | 描述 |
| - | - | - |
| encounterType | [EncounterType](#encountertype) | 最近玩家相遇的類型。此欄位為選擇性，預設為 Default。Default 沒有規定的意義，由呼叫者自行適當解讀此值。 |
| id | string | 另一位使用者的識別碼 (十進位整數 XUID)。 |
| network | [Network](#network) | 遇到另一位使用者的網路。 |
| timestamp | string | |


## Related topics

- [最近玩家](/zh-CN/services/xbox-services/multiplayer/mpa/concepts/live-mpa-recent-players.md)
- [最近的玩家](/zh-TW/services/xbox-services/multiplayer/mpa/concepts/live-mpa-recent-players.md)
- [伺服器](/zh-TW/services/playfab/multiplayer/servers/index.md)
- [与 PlayFab Lobby 和 Match 集成](/zh-CN/services/xbox-services/multiplayer/mpa/concepts/live-mpa-playfab-integration.md)
- [多人遊戲活動 (MPA) 功能概觀](/zh-TW/services/xbox-services/multiplayer/mpa/live-mpa-overview.md)
