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

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

> 張貼伺服器最近玩家

# 張貼伺服器最近玩家

附加至或更新一組使用者的最近玩家清單 (單向)。這基本上是用戶端 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 | 另一位使用者的識別碼 (十進位整數 XUID)。 |
| network | [Network](#network) | 遇到另一位使用者的網路。 |
| timestamp | string | |


## Related topics

- [POST /titles/{titleId}/recentplayergroups/server](https://docs.xbox.com/zh-TW/reference/live/rest/uri/multiplayeractivity/swagger-uris/uri-PostServerRecentPlayerGroup.md)
- [POST /titles/{titleId}/recentplayers](https://docs.xbox.com/zh-TW/reference/live/rest/uri/multiplayeractivity/swagger-uris/uri-PostUniRecentPlayers.md)
- [POST /titles/{titleId}/invites/server API](https://docs.xbox.com/zh-TW/reference/live/rest/uri/multiplayeractivity/swagger-uris/uri-SendServerInvite.md)
- [POST /titles/{titleId}/invites](https://docs.xbox.com/zh-TW/reference/live/rest/uri/multiplayeractivity/swagger-uris/uri-SendInvite.md)
- [POST /titles/{titleId}/activities/query](https://docs.xbox.com/zh-TW/reference/live/rest/uri/multiplayeractivity/swagger-uris/uri-ExternalGetActivityBatch.md)
