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

# 計算區段玩家數的教學課程

> 使用新的 GetSegmentPlayerCount API (預覽) 擷取 PlayFab 區段的玩家計數，此 API 取代了已淘汰的 GetPlayersInSegment 端點。

# 計算區段的玩家數 (預覽)

<Note>
  GetSegmentPlayerCount API 目前為預覽版。隨著我們持續收集意見反應並針對客戶使用情況進行最佳化，預期此 API 會持續變更。
</Note>

本教學課程將逐步引導您使用新的 GetSegmentPlayerCount API (目前為預覽版) 取得指定區段的玩家計數。這些 API 與 ExportPlayersInSegment API 和 GetSegmentExport API 一起，完全取代了已淘汰之 GetPlayersInSegment API 的功能。若要開始使用匯出 API，請依照此教學課程操作：[匯出區段中玩家的教學課程 - PlayFab | Microsoft Learn。](/zh-TW/services/playfab/live-service-management/game-configuration/segmentation/segmentation-export-players-in-a-segment)

將區段識別碼作為承載，向 GetSegmentPlayerCount API 傳送 POST 要求。回應中的「ProfilesInSegment」就是該區段的玩家計數。

<img src="https://mintcdn.com/microsoft-4404708b/IwSYTY5BEqd_x-HK/images/playfab/data-analytics/acting-data/get-segment-player-count.png?fit=max&auto=format&n=IwSYTY5BEqd_x-HK&q=85&s=6ffdf5b78fa010288319a7538599f230" alt="取得區段玩家計數" width="1833" height="387" data-path="images/playfab/data-analytics/acting-data/get-segment-player-count.png" />

<Note>
  此 API 需要「X-SecretKey」標頭，其值為遊戲秘密金鑰。「Content-Type」標頭應設定為「application/json」
</Note>


## Related topics

- [匯出區段中玩家的教學課程](/zh-TW/services/playfab/live-service-management/game-configuration/segmentation/segmentation-export-players-in-a-segment.md)
- [取得區段玩家數](/zh-TW/services/playfab/api-references/rest/admin/play-stream/get-segment-player-count.md)
- [針對整個玩家區段的大量動作](/zh-TW/services/playfab/data-analytics/acting-data/action-rules-bulk-actions-for-an-entire-player-segment.md)
- [玩家區段](/zh-TW/services/playfab/player-progression/player-data/player-segments.md)
- [協助工具中繼資料](/zh-TW/publishing/game-publishing/concepts/metadata-accessibility.md)
