> ## 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}/sessiontemplates/{sessionTemplateName}/sessions)

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

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

擷取工作階段範本文件。

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

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

<a id="ID4ET" />

## 備註

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

> **注意：**\
> 對於 2015 Multiplayer，此方法由 <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="ID4EKC" />

## 回應本文

此方法傳回的是工作階段參考的 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="ID4EUC" />

## 另請參閱

<a id="ID4EWC" />

##### 上層

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


## Related topics

- [XblMultiplayerSessionReferenceUri](/pt-BR/reference/live/xsapi-c/multiplayer_c/structs/xblmultiplayersessionreferenceuri.md)
- [Multiplayer Session Directory overview](/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
