> ## 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 (/users/xuid({xuid})/inbox)

> GET (/users/xuid({xuid})/inbox)

# GET (/users/xuid({xuid})/inbox)

从服务检索指定数量的用户消息摘要。
这些 URI 的域为 `msg.xboxlive.com`。

* [备注](#ID4EV)
* [URI 参数](#ID4EEB)
* [查询字符串参数](#ID4EIC)
* [授权](#ID4EGE)
* [隐私设置对资源的影响](#ID4ETE)
* [HTTP 状态代码](#ID4E5E)
* [JavaScript 对象表示法 (JSON) 响应](#ID4EMH)

## 备注

用户消息摘要仅包含消息主题。对于用户生成的消息,当前为消息文本的前 20 个字符。系统消息可能提供备用主题,例如 “LIVE System”。

消息按发送顺序的相反顺序返回;即,较新的消息先返回。

此 API 支持的唯一内容类型是 “application/json”,每次调用的 HTTP 标头中都需要此内容类型。

## URI 参数

| 参数 | 类型 | 说明 |
| - | - | - |
| xuid | 64 位无符号整数 | 发出请求的玩家的 XBOX User ID (XUID)。 |

## 查询字符串参数

\| 属性 | 类型 | 最大长度 | 备注 |
\| --- | --- | --- | --- | --- | --- | --- |
\| maxItems | int | 100 | 返回的最大消息数。 |
\| continuationToken | string |  | 在之前的枚举调用中返回的字符串;用于继续枚举。 |
\| skipItems | int | 100 | 要跳过的消息数;如果存在 continuationToken,则忽略此参数。 |

## 授权

必须具有自己的用户声明才能检索用户消息摘要。

## 隐私设置对资源的影响

只有你自己可以枚举自己的用户消息。

## HTTP 状态代码

服务针对使用此方法对此资源发出的请求,返回本节中的某个状态代码。有关与 XBOX Live 服务一同使用的标准 HTTP 状态代码的完整列表,请参见 [标准 HTTP 状态代码](https://devdocs.xbox.com/zh-CN/reference/live/rest/additional/httpstatuscodes.md)。

\| 代码 | 说明 |
\| --- | --- | --- | --- | --- | --- | --- | --- | --- |
\| 200 | 请求成功。 |
\| 400 | 服务无法理解格式错误的请求。通常是无效参数。 |
\| 403 | 不允许该用户或服务发出请求。 |
\| 404 | URI 中缺少有效的 XUID。 |
\| 409 | 基于传递的延续标记,底层集合已更改。 |
\| 416 | 要跳过的项数大于可用项数。 |
\| 500 | 常规服务器端错误。 |

## JavaScript 对象表示法 (JSON) 响应

如果调用成功,服务将以 JSON 格式返回结果数据。

| 属性 | 类型 | 最大长度 | 备注 |
| - | - | - | - |
| results | Message\[] | 100 | 用户消息数组 |
| pagingInfo | PagingInfo | | 当前结果集的分页信息 |

#### Message

| 属性 | 类型 | 最大长度 | 备注 |
| - | - | - | - |
| header | Header | | 用户消息标头 |
| messageSummary | string | 20 | UTF-8;通常为消息的前 20 个字符 |

#### Header

| 属性 | 类型 | 最大长度 | 备注 |
| - | - | - | - |
| id | string | 50 | 消息标识符,用于检索消息详细信息或删除消息。 |
| isRead | bool | | 指示用户已读取消息详细信息的标志。 |
| sent | DateTime | | 消息发送时的 UTC 日期和时间。(由服务提供。) |
| expiration | DateTime | | 消息过期时的 UTC 日期和时间。(所有消息都有最大生存期,将在未来确定。) |
| messageType | string | 50 | 消息类型:User、System、FriendRequest、Video、QuickChat、VideoChat、PartyChat、Title、GameInvite。 |
| senderXuid | ulong | | 发送方的 XUID。 |
| sender | string | 15 | 发送方的游戏玩家代号。 |
| hasAudio | bool | | 消息是否附带音频(语音)附件。 |
| hasPhoto | bool | | 消息是否附带照片附件。 |
| hasText | bool | | 消息是否包含文本。 |

#### Paging Info

| 属性 | 类型 | 最大长度 | 备注 |
| - | - | - | - |
| continuationToken | string | 100 | 由服务器视情况返回。允许后续调用继续枚举。 |
| totalItems | int | | 收件箱中的消息总数。 |

#### 响应示例

```cpp theme={null}
{
          "results":
          [
            {
              "header":
              {
                "expiration":"2011-10-11T23:59:59.9999999",
                "id":"opaqueBlobOfText",
                "messageType":"User",
                "isRead":false,
                "senderXuid":"123456789",
                "sender":"Striker",
                "sent":"2011-05-08T17:30:00Z",
                "hasAudio":false,
                "hasPhoto":false,
                "hasText":true
              },
            "messageSummary":"first 20 chars"
          },
          ...
        ],
        "pagingInfo":
          {
          "continuationToken":"opaqueBlobOfText"
          "totalItems":5,
          }
        }

```

#### 错误响应

出错时,服务可能返回 errorResponse 对象,其中可能包含来自服务环境的值。

\| 属性 | 类型 | 说明 |
\| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
\| errorSource | string | 错误来源的指示。 |
\| errorCode | int | 与错误关联的数字代码(可以为 null)。 |
\| errorMessage | string | 如果配置为显示详细信息,则显示错误的详细信息。 |

## 另请参阅

##### 父主题

[/users/xuid({xuid})/inbox](https://devdocs.xbox.com/zh-CN/reference/live/rest/uri/users/uri-usersxuidinbox.md)

##### 参考资料  [标准 HTTP 状态代码](https://devdocs.xbox.com/zh-CN/reference/live/rest/additional/httpstatuscodes.md)


## Related topics

- [GET (/users/xuid({xuid})/inbox/{messageId})](https://devdocs.xbox.com/zh-CN/reference/live/rest/uri/users/uri-usersxuidinboxmessageidget.md)
- [/users/xuid({xuid})/inbox](https://devdocs.xbox.com/zh-CN/reference/live/rest/uri/users/uri-usersxuidinbox.md)
- [DELETE (/users/xuid({xuid})/inbox/{messageId})](https://devdocs.xbox.com/zh-CN/reference/live/rest/uri/users/uri-usersxuidinboxmessageiddelete.md)
- [/users/xuid({xuid})](https://devdocs.xbox.com/zh-CN/reference/live/rest/uri/presence/uri-usersxuid.md)
- [GET (/users/xuid({xuid}))](https://devdocs.xbox.com/zh-CN/reference/live/rest/uri/presence/uri-usersxuidget.md)
