> ## 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 /titles/{titleId}/users/{xuid}/activities API

> 取得活動

# 取得活動

取得正在玩特定遊戲之使用者的活動。此 API 可讓遊戲用戶端或伺服器取得正在玩特定遊戲之使用者的活動。

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

## URI 參數

| 參數 | 位置 | 必要 | 類型 | 描述 |
| - | - | - | - | - |
| titleId | path | TRUE | integer | 傳送要求的目標遊戲 titleId。 |
| xuid | path | TRUE | string | 目前要求中所參考使用者的 XUID。XUID 以十進位整數表示。 |

## 要求標頭

| 名稱 | 必要 | 類型 | 描述 |
| - | - | - | - |
| Authorization | TRUE | integer | 呼叫者必須以 XBL 3.0 授權格式提供 XToken。例如，Authorization: XBL3.0 x=2553948354698;>encrypted token\<) |
| Content-Type | TRUE | string | ContentType 必須設定為 application/json |

## 回應

| 名稱 | 類型 | 描述 |
| - | - | - |
| 200 OK | GetActivityResponse | 包含指定使用者活動的傳回物件。 |
| 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." |
| 其他狀態碼 | [ThrottledEntity](#throttledentity) | 要求過多。標頭 Retry-After: integer |

## 定義

* [ErrorResponse](#errorresponse)
* [GetActivityResponse](#getactivityresponse)
* [JoinRestriction](#joinrestriction)
* [Platform](#platform)
* [ThrottledEntity](#throttledentity)

### ErrorResponse

| 名稱 | 類型 | 描述 |
| - | - | - |
| debugMessage | string | 可用於偵錯的人類可讀錯誤訊息版本。 |
| errorCode | string | 錯誤碼列舉。 |

### GetActivityResponse

| 名稱 | 類型 | 描述 |
| - | - | - |
| connectionString | string | 連線字串是傳遞給連線用戶端以加入遊戲的物件。連線字串通常包含伺服器 IP 等資訊，讓加入的使用者能夠連線。連線字串的長度限制為 512 個字元。 |
| currentPlayers | integer | 已在多人遊戲活動中與使用者一起遊玩的玩家人數。 |
| groupId | string | 用來將參與同一場遊戲的所有使用者分組的唯一識別碼。 |
| joinRestriction | [JoinRestriction](#joinrestriction) | 決定誰可以加入目前玩家的設定。 |
| maxPlayers | integer | 在目前活動中可與此玩家一起遊玩的最大玩家人數。 |
| platform | [Platform](#platform) | |
| sequenceNumber | string | 這是單調遞增數字 (ulong) 的字串表示法，用戶端必須在每個要求中傳入。它用於保證活動更新的順序。用戶端的 Unix 時間是 sequenceNumber 的一個好例子，因為它保證會遞增。必須大於 0，且不能大於 ulong 的最大值。 |
| titleId | integer | 要求活動之遊戲的 titleId。 |

### JoinRestriction

| 名稱 | 類型 | 描述 |
| - | - | - |
| Followed | string | |
| InviteOnly | string | |
| Public | string | |

### Platform

| 名稱 | 類型 | 描述 |
| - | - | - |
| Android | string | |
| IOS | string | |
| Nintendo | string | |
| PlayStation | string | |

### ThrottledEntity

| 名稱 | 類型 | 描述 |
| - | - | - |
| 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)
- [XblMultiplayerActivityDetails](https://devdocs.xbox.com/reference/live/xsapi-c/multiplayer_c/structs/xblmultiplayeractivitydetails.md)
- [Activities](https://devdocs.xbox.com/services/xbox-services/multiplayer/mpa/concepts/live-mpa-activities.md)
- [Sending reputation feedback from a title](https://devdocs.xbox.com/services/xbox-services/community/reputation/concepts/live-sending-reputation-feedback.md)
- [XblPresenceTitlePresenceChangedHandler](https://devdocs.xbox.com/reference/live/xsapi-c/presence_c/functions/xblpresencetitlepresencechangedhandler.md)
