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

# GET (/serviceconfigs/{scid}/sessions)

> GET (/serviceconfigs/{scid}/sessions)

# GET (/serviceconfigs/{scid}/sessions)

擷取指定的工作階段資訊。

> **重要：**\
> 此方法現在要求每個要求都需要 X-Xbl-Contract-Version: 104/105 或更新版本的標頭元素。

* [備註](#ID4ET)
* [URI 參數](#ID4EKB)
* [HTTP 狀態碼](#ID4EXB)
* [要求本文](#ID4EAC)
* [回應本文](#ID4ELC)

<a id="ID4ET" />

## 備註

此 HTTP/REST 方法會擷取所提供篩選條件的工作階段資訊。此方法可由 **Microsoft.Xbox.Services.Multiplayer.MultiplayerService.GetSessionsAsync** 包裝。

> **注意：**\
> 對於 2015 多人遊戲，此方法由 <b>Microsoft.Xbox.Services.Multiplayer.MultiplayerService.GetSessionsForUsersFilterAsync</b> 呼叫。

> **注意：**\
> 每次呼叫此方法都必須包含關鍵字、XBOX 使用者識別碼篩選條件，或兩者皆包含。如果呼叫者沒有 <i>private</i> 和 <i>reservations</i> 參數的正確權限，無論是否確實存在此類工作階段，此方法都會傳回錯誤碼 403 Forbidden。

<a id="ID4EKB" />

## URI 參數

\| 參數| 類型| 描述|
\| --- | --- | --- | --- | --- | --- |
\| scid| GUID| 服務設定識別碼 (SCID)。工作階段識別碼的第 1 部分。|
\| keyword| string| 用來篩選結果的關鍵字，只保留以該字串識別的工作階段。|
\| xuid| GUID| 要擷取其工作階段之使用者的 XBOX 使用者識別碼。使用者必須在工作階段中處於作用中狀態。|
\| reservations| string| 指出工作階段清單是否包含使用者尚未接受之工作階段的值。此參數只能設為 true。此設定需要呼叫者具備工作階段的伺服器層級存取權，或呼叫者的 XUID 宣告符合 XBOX 使用者識別碼篩選條件。 |
\| inactive| string| 指出工作階段清單是否包含使用者已接受但未在積極遊玩之工作階段的值。此參數只能設為 true。|
\| private| string| 指出工作階段清單是否包含私人工作階段的值。此參數只能設為 true。只有在查詢您自己的工作階段，或以伺服器對伺服器方式查詢時才有效。將此參數設為 true 時，需要呼叫者具備工作階段的伺服器層級存取權，或呼叫者的 XUID 宣告符合 XBOX 使用者識別碼篩選條件。 |
\| visibility| string| 指出用於篩選結果之可見性狀態的列舉值。目前此參數只能設為 Open，以包含開放的工作階段。請參閱 <b>MultiplayerSessionVisibility</b>。|
\| version| string| 正整數，指出要包含之工作階段的主要工作階段版本 (或更低版本)。此值必須小於或等於要求的合約版本除以 100 的餘數。|
\| take| string| 正整數，指出要擷取的工作階段數目上限。|

<a id="ID4EXB" />

## HTTP 狀態碼

服務會傳回適用於 MPSD 的 HTTP 狀態碼。

<a id="ID4EAC" />

## 要求本文

此要求的本文中不會傳送任何物件。

<a id="ID4ELC" />

## 回應本文

此方法的傳回值是工作階段參考的 JSON 陣列，其中內嵌了部分工作階段資料。

```cpp theme={null}
{
    "results": [ {
            "xuid": "9876",    // If the session was found from a xuid, that xuid.
            "startTime": "2009-06-15T13:45:30.0900000Z",
            "sessionRef": {
                "scid": "foo",
                "templateName": "bar",
                "name": "session-seven"
            },
            "accepted": 4,    // Approximate number of non-reserved members.
            "status": "active",    // or "reserved" or "inactive". This is the state of the user in the session, not the session itself. Only present if the session was found using a xuid.
            "visibility": "open",    // or "private", "visible", or "full"
            "joinRestriction": "local",    // or "followed". Only present if 'visibility' is "open" or "full" and the session has a join restriction.
            "myTurn": true,    // Not present is the same as 'false'. Only present if the session was found using a xuid.
            "keywords": [ "one", "two" ]
        }
    ]
}

```

<a id="ID4EWC" />

## 另請參閱

<a id="ID4EYC" />

##### 上層

[/serviceconfigs/{scid}/sessions](/zh-TW/reference/live/rest/uri/sessiondirectory/uri-serviceconfigsscidsessions)


## Related topics

- [Multiplayer Session Directory overview](/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
- [Multiplayer Session Directory 개요](/ko/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
- [Visão geral do Multiplayer Session Directory](/pt-BR/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
- [Vue d'ensemble de Multiplayer Session Directory](/fr-CA/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
- [Información general de Multiplayer Session Directory](/es/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
