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

# PUT /titles/{titleId}/users/{xuid}/activities

> Update Activity

# Update Activity

特定のタイトルをプレイしているユーザーのアクティビティを設定または更新します。
この API により、ゲーム クライアントまたはサーバーは、特定のタイトルをプレイしているユーザーのマルチプレイヤー アクティビティを設定/更新できます。ユーザーがマルチプレイヤー アクティビティでアクティブになったらすぐにアクティビティを設定する必要があります。XBOX Live ユーザーは他のユーザー (通常はフレンド) のアクティビティの変更をサブスクライブでき、これらの更新は RTA 経由で XBOX クライアントにプッシュされます。

```http theme={null}
PUT /titles/{titleId}/users/{xuid}/activities
```

## URI パラメーター

| Parameter | In | Required | Type | Description |
| - | - | - | - | - |
| titleId | path | TRUE | integer | リクエストの送信対象となるゲームの titleId。 |
| xuid | path | TRUE | string | 現在のリクエストで参照されているユーザーの XUID。XUID は 10 進整数として表されます。 |

## リクエスト ヘッダー

| Name | Required | Type | Description |
| - | - | - | - |
| Authorization | TRUE | integer | 呼び出し元は XBL 3.0 認証形式で XToken を指定する必要があります。例: Authorization: XBL3.0 x=2553948354698;\<encrypted token>) |
| Content-Type | TRUE | string | ContentType は application/json に設定する必要があります |

## リクエスト本文

| Name | Required | Type | Description |
| - | - | - | - |
| connectionString | TRUE | string | 接続文字列は、ゲームに参加するために接続クライアントに渡されるオブジェクトです。接続文字列には通常、参加するユーザーが接続できるようにするためのサーバー IP などの情報が含まれます。接続文字列の長さは 512 文字に制限されています。 |
| joinRestriction | TRUE | JoinRestriction | 現在のプレイヤーに参加できる人を制御する設定。 |
| sequenceNumber | TRUE | string | これは、クライアントがリクエストごとに渡す必要がある単調増加する数値 (ulong) の文字列表現です。アクティビティの更新の順序を保証するために使用されます。sequenceNumber の良い例はクライアントの UNIX 時刻です。増加することが保証されるためです。0 より大きく、ulong の最大値を超えることはできません。 |
| currentPlayers | | integer | マルチプレイヤー アクティビティですでにユーザーと一緒にプレイしているプレイヤーの数。 |
| groupId | | string | 同じゲームの一部としてプレイしているすべてのユーザーをグループ化する一意の識別子。 |
| maxPlayers | | integer | このプレイヤーと現在のアクティビティで一緒にプレイできる最大プレイヤー数。 |
| platform | | [Platform](#platform) | |

## レスポンス

| Name | Type | Description |
| - | - | - |
| 204 No Content | | アクティビティが正常に設定されました。 |
| 400 Bad Request | [ErrorResponse](#errorresponse) | リクエストの処理中にエラーが発生しました。考えられるエラー コード: "RequestValidationError: The request validation has failed.", " AuthorizationError: The caller is not allowed to access the resource. Too many requests." |
| Other Status Codes | [ThrottledEntity](#throttledentity) | リクエストが多すぎます。Headers Retry-After: integer |

## 定義

* [ErrorResponse](#errorresponse)
* [JoinRestriction](#joinrestriction)
* [Platform](#platform)
* [SetActivityRequest](#setactivityrequest)
* [ThrottleEntity](#throttleentity)

### ErrorResponse

| Name | Type | Description |
| - | - | - |
| debugMessage | string | デバッグに使用できる、人間が読めるエラー メッセージ。 |
| errorCode | string | エラー コード列挙型。 |

### JoinRestriction

現在のプレイヤーに参加できる人を制御する設定。

| Name | Type | Description |
| - | - | - |
| Followed | string | |
| InviteOnly | string | |
| Public | string | |

### Platform

| Name | Type | Description |
| - | - | - |
| Android | string | |
| IOS | string | |
| Nintendo | string | |
| PlayStation | string | |
| Scarlett | string | |
| Win32 | string | |
| WindowsOneCore | string | |
| XboxOne | string | |

## SetActivityRequest

リクエスト内でアクティビティのプラットフォームが設定されている場合、そのプラットフォームでのみ参加可能になります。プラットフォームが設定されていない場合、アクティビティはゲームをプレイできるすべてのプラットフォームで参加可能になります。

| Name | Type | Description |
| - | - | - |
| connectionString | string | 接続文字列は、ゲームに参加するために接続クライアントに渡されるオブジェクトです。接続文字列には通常、参加するユーザーが接続できるようにするためのサーバー IP などの情報が含まれます。接続文字列の長さは 512 文字に制限されています。 |
| currentPlayers | integer | マルチプレイヤー アクティビティですでにユーザーと一緒にプレイしているプレイヤーの数。 |
| groupId | string | 同じゲームの一部としてプレイしているすべてのユーザーをグループ化する一意の識別子。 |
| joinRestriction | [JoinRestriction](#joinrestriction) | 現在のプレイヤーに参加できる人を制御する設定。 |
| maxPlayers | integer | このプレイヤーと現在のアクティビティで一緒にプレイできる最大プレイヤー数。 |
| platform | [Platform](#platform) | |
| sequenceNumber | string | これは、クライアントがリクエストごとに渡す必要がある単調増加する数値 (ulong) の文字列表現です。アクティビティの更新の順序を保証するために使用されます。sequenceNumber の良い例はクライアントの UNIX 時刻です。増加することが保証されるためです。0 より大きく、ulong の最大値を超えることはできません。 |

### ThrottledEntity

| Name | Type | Description |
| - | - | - |
| currentRequests | string | 現在のリクエスト数 - 同時実行数またはレート。 |
| debugMessage | string | デバッグに使用できる、人間が読めるスロットル メッセージ。 |
| limitType | string | 制限の種類 (例: 同時実行またはレート)。 |
| maxRequests | string | 許可される最大リクエスト数 - 同時実行数またはレート。 |
| periodInSeconds | string | レートまたは同時実行の制限を超えた場合に適用される秒単位の期間。 |
| version | string | 現在のスロットル契約バージョン。 |


## Related topics

- [Example code for Multiplayer Activity](https://devdocs.xbox.com/services/xbox-services/multiplayer/mpa/how-to/live-mpa-client-how-to.md)
- [Activities](https://devdocs.xbox.com/services/xbox-services/multiplayer/mpa/concepts/live-mpa-activities.md)
- [XblMultiplayerActivityDetails](https://devdocs.xbox.com/reference/live/xsapi-c/multiplayer_c/structs/xblmultiplayeractivitydetails.md)
- [XblTitleStorageUploadBlobAsync](https://devdocs.xbox.com/es/reference/live/xsapi-c/title_storage_c/functions/xbltitlestorageuploadblobasync.md)
