> ## 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 (/handles)

> POST (/handles)

# POST (/handles)

設定使用者目前活動的多人遊戲工作階段，並在需要時邀請工作階段成員。

> **重要：**\
> 此方法由 2015 多人遊戲使用，僅適用於該多人遊戲版本及更新版本。其適用於範本合約 104/105 或更新版本，且每個要求都需要 X-Xbl-Contract-Version: 104/105 或更新版本的標頭元素。

* [備註](#ID4ET)
* [URI 參數](#ID4EHB)
* [HTTP 狀態碼](#ID4EPB)
* [要求本文](#ID4EVB)
* [回應本文](#ID4EJC)

<a id="ID4ET" />

## 備註

此 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"。回應本文是邀請控制代碼。

<a id="ID4EHB" />

## URI 參數

無

<a id="ID4EPB" />

## HTTP 狀態碼

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

<a id="ID4EVB" />

## 要求本文

<a id="ID4E1B" />

### 設定活動的要求本文

```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"
  },
}

```

<a id="ID4EBC" />

### 傳送邀請的要求本文

```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",
}

```

<a id="ID4EJC" />

## 回應本文

<a id="ID4EOC" />

### 設定活動的回應本文

無。

<a id="ID4ESC" />

### 傳送邀請的回應本文

邀請控制代碼。

<a id="ID4EXC" />

## 另請參閱

<a id="ID4EZC" />

##### 上層

[/handles](/zh-TW/reference/live/rest/uri/sessiondirectory/uri-handles)


## Related topics

- [PFLobbyPostUpdate](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbypostupdate.md)
- [PFLobbyServerPostUpdate](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbyserverpostupdate.md)
- [PFLobbyServerPostUpdateAsServer](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbyserverpostupdateasserver.md)
