> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# POST (/handles)

> POST (/handles)

# POST (/handles)

ユーザーの現在のアクティビティに対するマルチプレイヤー セッションを設定し、必要に応じてセッション メンバーを招待します。

> **重要:**\
> このメソッドは 2015 Multiplayer で使用され、そのマルチプレイヤー バージョン以降にのみ適用されます。テンプレート コントラクト 104/105 以降での使用を意図しており、すべてのリクエストにヘッダー要素 X-Xbl-Contract-Version: 104/105 以降が必要です。

* [解説](#ID4ET)
* [URI パラメーター](#ID4EHB)
* [HTTP ステータス コード](#ID4EPB)
* [リクエスト本文](#ID4EVB)
* [レスポンス本文](#ID4EJC)

## 解説

この HTTP/REST メソッドは、現在のアクティビティのセッションを設定するために使用できます。この場合、このメソッドは **Microsoft.Xbox.Services.Multiplayer.MultiplayerService.SetActivityAsync** によってラップできます。リクエスト本文では、JSON ファイル内の **sessionRef** オブジェクトを使用してセッション参照を定義し、type フィールドを "activity" に設定する必要があります。レスポンス本文は取得されません。セッション参照で指定される項目の定義については、**Microsoft.Xbox.Services.Multiplayer.MultiplayerSessionReference** を参照してください。

この POST メソッドは、ハンドルで指定されたユーザーをセッションに招待するためにも使用できます。この場合、このメソッドは **Microsoft.Xbox.Services.Multiplayer.MultiplayerService.SendInvitesAsync** によってラップできます。POST メソッドをこのように使用する場合は、リクエスト本文でセッション参照を定義する必要がありますが、type フィールドは "invite" に設定します。レスポンス本文は招待ハンドルです。

## URI パラメーター

なし

## HTTP ステータス コード

サービスは、MPSD に適用される HTTP ステータス コードを返します。

## リクエスト本文

### アクティビティ設定のためのリクエスト本文

```cpp theme={null}
{
  "version": 1,
  "type": "activity",
  "sessionRef": {
    "scid": "bd6c41c3-01c3-468a-a3b5-3e0fe8133862",
    "templateName": "deathmatch",
    // The session name is optional in a POST; if not specified, MPSD fills in a GUID.//
    "name": "session-49"
  },
}

```

### 招待送信のためのリクエスト本文

```cpp theme={null}
{
  // Common handle fields
  "id: "47ca0049-a5ba-4bc1-aa22-fcf834ce4c13",
  "version": 1,
  "type": "invite",
  "sessionRef": {
    "scid": "bd6c41c3-01c3-468a-a3b5-3e0fe8133862",
    "templateName": "deathmatch",
    "name": "session-49"
   },
   "inviteAttributes": {
     "titleId" : {titleId}, // The title being invited to, in decimal uint32. This value is used to find the title name and/or image.
     "context" : {context}, // The title defined context token. Must be 256 characters or less when URI-encoded.
     "contextString" : {contextstring}, // The string name of a custom invite string to display in the invite notification.
     "senderString" : {sender} // The string name of the sender when the sender is a service.
   },
   "invitedXuid": "3210",
}

```

## レスポンス本文

### アクティビティ設定のためのレスポンス本文

なし。

### 招待送信のためのレスポンス本文

招待ハンドル。

## 関連項目

##### 親

[/handles](https://docs.xbox.com/ja-jp/reference/live/rest/uri/sessiondirectory/uri-handles.md)


## Related topics

- [POST (/handles/query)](https://docs.xbox.com/ja-jp/reference/live/rest/uri/sessiondirectory/uri-handlesquerypost.md)
- [/handles](https://docs.xbox.com/ja-jp/reference/live/rest/uri/sessiondirectory/uri-handles.md)
- [POST (/handles/query?include=relatedInfo)](https://docs.xbox.com/ja-jp/reference/live/rest/uri/sessiondirectory/uri-handlesqueryincludepost.md)
- [/handles/query](https://docs.xbox.com/ja-jp/reference/live/rest/uri/sessiondirectory/uri-handlesquery.md)
- [PFLobbyServerPostUpdate](https://docs.xbox.com/ja-jp/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbyserverpostupdate.md)
