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

## 备注

此 HTTP/REST 方法检索提供的筛选器的会话模板信息。此方法可以由 **Microsoft.Xbox.Services.Multiplayer.MultiplayerService.GetSessionsAsync** 包装。

> **注意：**\
> 对于 2015 多人游戏，此方法由 **Microsoft.Xbox.Services.Multiplayer.MultiplayerService.GetSessionsForUsersFilterAsync** 调用。

> **注意：**\
> 对此方法的每次调用都必须包含关键字、XBOX 用户 ID 筛选器或两者。如果调用方对 *private* 和 *reservations* 参数没有正确的权限，则该方法将返回错误代码 403 Forbidden，无论是否实际存在此类会话。

## URI 参数

\| 参数| 类型| 说明|
\| --- | --- | --- | --- | --- | --- |
\| scid| GUID| 服务配置标识符 (SCID)。会话 ID 的第 1 部分。|
\| keyword| string| 用于将结果筛选为仅使用该字符串标识的会话的关键字。|
\| xuid| GUID| 要检索其会话的用户的 XBOX 用户 ID。用户必须在会话中处于活动状态。 |
\| reservations| string| 指示会话列表是否包含用户尚未接受的会话的值。此参数只能设置为 true。此设置要求调用方对会话具有服务器级访问权限，或调用方的 XUID 声明与 XBOX 用户 ID 筛选器匹配。 |
\| inactive| string| 指示会话列表是否包含用户已接受但未主动参与的会话的值。此参数只能设置为 true。 |
\| private| string| 指示会话列表是否包含专用会话的值。此参数只能设置为 true。仅在查询您自己的会话或以服务器到服务器方式查询时有效。将此参数设置为 true 要求调用方对会话具有服务器级访问权限，或调用方的 XUID 声明与 XBOX 用户 ID 筛选器匹配。 |
\| visibility| string| 指示用于筛选结果的可见性状态的枚举值。目前此参数只能设置为 Open 以包括开放会话。请参阅 **MultiplayerSessionVisibility**。 |
\| version| string| 一个正整数，指示要包含的会话的主要会话版本或更低版本。该值必须小于或等于请求的协定版本对 100 取模的值。 |
\| take| string| 一个正整数，指示要检索的最大会话数。|

## HTTP 状态代码

服务返回适用于 MPSD 的 HTTP 状态代码。

## 请求正文

此请求正文中不发送任何对象。

## 响应正文

此方法的返回值是会话引用的 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" ]
        }
    ]
}

```

## 另请参阅

##### 上级

[/serviceconfigs/{scid}/sessiontemplates/{sessionTemplateName}/sessions](https://devdocs.xbox.com/zh-CN/reference/live/rest/uri/sessiondirectory/uri-serviceconfigsscidsessiontemplatessessiontemplatenamesessions)


## Related topics

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