> ## 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/{messageId})

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

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

检索特定用户消息的详细消息文本,并在服务上将其标记为已读。
这些 URI 的域为 `msg.xboxlive.com`。

* [备注](#ID4EV)
* [URI 参数](#ID4EEB)
* [授权](#ID4ERB)
* [请求正文](#ID4E3B)
* [隐私设置对资源的影响](#ID4EJC)
* [HTTP 状态代码](#ID4EUC)
* [JavaScript 对象表示法 (JSON) 响应](#ID4EUE)

## 备注

get 操作只能对 User、System 和 FriendRequest 消息类型执行。

此 URI 需要在 Xbox.com 上刷新。目前,XBOX 360 在用户注销并重新登录之前,不会更新已读/未读状态。

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

## URI 参数

| 参数 | 类型 | 说明 |
| - | - | - |
| xuid | 64 位无符号整数 | 发出请求的玩家的 XBOX User ID (XUID)。 |
| messageId | string\[50] | 正在检索或删除的消息的 ID。 |

## 授权

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

## 请求正文

此请求的正文中不发送任何对象。

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

只有你自己可以检索自己的用户消息。

## HTTP 状态代码

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

\| 代码 | 说明 |
\| --- | --- | --- | --- | --- |
\| 200 | 成功。 |
\| 400 | 无法正确转换 XUID。 |
\| 403 | 无法转换 XUID 或找不到有效的 XUID 声明。 |
\| 404 | 缺少有效的 XUID,或找不到消息 ID 或解析不正确。 |
\| 500 | 常规服务器端错误,或消息类型对 GET 无效。 |

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

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

#### UserMessageHeader

| 属性 | 类型 | 最大长度 | 备注 |
| - | - | - | - |
| header | Header | | JSON 对象 |
| messageText | string | 256 | UTF-8 |

#### Header

| 属性 | 类型 | 最大长度 | 备注 |
| - | - | - | - |
| sent | DateTime | | 消息发送时的日期和时间。(由服务提供。) |
| expiration | DateTime | | 消息过期时的日期和时间。(所有消息都有最大生存期,将在未来确定。) |
| messageType | string | 13 | 消息类型:User、System、FriendRequest。 |
| senderXuid | ulong | | 发送方的 XUID。 |
| sender | string | 15 | 发送方的游戏玩家代号。 |
| hasAudio | bool | | 消息是否附带音频(语音)附件。 |
| hasPhoto | bool | | 消息是否附带照片附件。 |
| hasText | bool | | 消息是否包含文本。 |

#### 响应示例

```cpp theme={null}
{
          "header":
          {
            "expiration":"2011-10-11T23:59:59.9999999",
            "messageType":"User",
            "senderXuid":"123456789",
            "sender":"Striker",
            "sent":"2011-05-08T17:30:00Z",
            "hasAudio":false,
            "hasPhoto":false,
            "hasText":true
          },
        "messageText":"random user text up to 256 characters"
        }

```

#### 错误响应

出错时,服务可能返回 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)

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


## Related topics

- [XblAchievementsGetAchievementsForTitleIdAsync](https://devdocs.xbox.com/zh-TW/reference/live/xsapi-c/achievements_c/functions/xblachievementsgetachievementsfortitleidasync.md)
- [XblUserStatisticsGetSingleUserStatisticAsync](https://devdocs.xbox.com/ja-jp/reference/live/xsapi-c/user_statistics_c/functions/xbluserstatisticsgetsingleuserstatisticasync.md)
