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

# POST (/serviceconfigs/{scid}/batch)

> POST (/serviceconfigs/{scid}/batch)

# POST (/serviceconfigs/{scid}/batch)

对服务配置的多个 XBOX 用户 ID 创建批处理查询。

> **重要：**\
> 此方法由 2015 多人游戏使用，仅适用于该多人游戏版本及更高版本。它旨在与模板协定 104/105 或更高版本一起使用，并且每个请求都需要一个 X-Xbl-Contract-Version: 104/105 或更高版本的头元素。

* [备注](#ID4ET)
* [URI 参数](#ID4ELB)
* [查询字符串参数](#ID4EVB)
* [HTTP 状态代码](#ID4EGF)
* [请求正文](#ID4ENF)
* [响应正文](#ID4EWF)

## 备注

此 HTTP/REST 方法在服务配置 ID (SCID) 级别对多个 XBOX 用户 ID 创建批处理查询。此方法可以由 **Microsoft.Xbox.Services.Multiplayer.MultiplayerService.GetSessionsForUsersFilterAsync** 包装。

对于 2015 多人游戏，如果所有查询相同但处理不同的 XBOX 用户 ID (XUID)（在 *xuid* 查询字符串参数中表示），则可以将多个查询组合到单个调用中。请注意，对于常规查询和批处理查询，查询字符串参数和响应是相同的。

对于批处理查询，属于每个 XUID 的会话按 *xuid* 参数在请求中呈现的相同顺序写入响应。同一个会话可能会在响应中多次出现，每匹配一个 *xuid* 出现一次。

## URI 参数

\| 参数| 类型| 说明|
\| --- | --- | --- | --- |
\| scid| GUID| 服务配置标识符 (SCID)。会话标识符的第 1 部分。|

## 查询字符串参数

可以使用下表中的查询字符串参数来修改查询。

\| **参数**| **类型**| **说明**|
\| --- | --- | --- | --- | --- | --- | --- |
\| keyword| string| 关键字，例如 “foo”，如果要检索会话或模板，则必须在其中找到该关键字。 |
\| xuid| 64 位无符号整数| 要包含在查询中的会话的 XBOX 用户 ID，例如 “123”。默认情况下，用户必须在会话中处于活动状态才能被包括在内。 |
\| reservations| boolean| 为 true 时，包括用户被设置为预留玩家但尚未加入成为活动玩家的会话。此参数仅在查询您自己的会话或以服务器到服务器方式查询特定用户的会话时使用。 |
\| inactive| boolean| 为 true 时，包括用户已接受但未主动参与的会话。用户处于 “ready” 但非 “active” 状态的会话视为不活动。 |
\| private| boolean| 为 true 时，包括专用会话。此参数仅在查询您自己的会话或以服务器到服务器方式查询特定用户的会话时使用。 |
\| visibility| string| 会话的可见性状态。可能的值由 **MultiplayerSessionVisibility** 定义。如果此参数设置为 “open”，则查询应仅包括开放会话。如果设置为 “private”，则 *private* 参数必须设置为 true。 |
\| version| 32 位有符号整数| 应包括的最大会话版本。例如，值 2 指定仅包括主要会话版本为 2 或更低的会话。版本号必须小于或等于请求的协定版本对 100 取模的值。 |
\| take| 32 位有符号整数| 要检索的最大会话数。此数字必须在 0 到 100 之间。 |

将 *private* 或 *reservations* 设置为 true 需要对会话具有服务器级访问权限。或者，这些设置要求调用方的 XUID 声明与 URI 中的 XUID 筛选器匹配。否则，无论是否实际存在此类会话，都会返回 HTTP/403 状态代码。

## HTTP 状态代码

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

## 请求正文

```cpp theme={null}
{ "xuids": [ "1234", "5678" ] }

```

## 响应正文

此方法的返回值是会话引用的 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}/batch](https://devdocs.xbox.com/zh-CN/reference/live/rest/uri/sessiondirectory/uri-serviceconfigsscidbatch)


## Related topics

- [Xbox services configuration IDs, for Managed Partners](https://devdocs.xbox.com/services/xbox-services/fundamentals/portal-config/live-service-config-ids-mp.md)
- [IDs de configuração dos serviços do Xbox para Managed Partners](https://devdocs.xbox.com/pt-BR/services/xbox-services/fundamentals/portal-config/live-service-config-ids-mp.md)
- [Setting up sandboxes](https://devdocs.xbox.com/services/xbox-services/fundamentals/sandboxes/live-setting-up-sandboxes.md)
- [ID de configuration des services Xbox, pour les partenaires gérés](https://devdocs.xbox.com/fr-CA/services/xbox-services/fundamentals/portal-config/live-service-config-ids-mp.md)
- [Multiplayer Session Directory overview](https://devdocs.xbox.com/services/xbox-services/multiplayer/mpsd/live-mpsd-overview.md)
