你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

获取平台通知服务 (PNS) 反馈

检索 Azure 存储容器 URL。 容器具有通知中心的反馈数据。 然后,调用方可以使用 Azure 存储服务 REST API 检索容器的内容。

请求

方法 请求 URI HTTP 版本
GET https://{namespace}.servicebus.windows.net/{Notification Hub}/feedbackcontainer?api-version=2015-01 HTTP/1.1

请求标头

下表介绍必需的和可选的请求标头。

请求标头 说明
Content-Type application/xml;type=entry;charset=utf-8
授权 使用 服务总线进行共享访问签名身份验证中指定的生成的 SAS 令牌。
x-ms-version 2015-01

请求正文

无。

响应

响应包括 HTTP 状态代码和一组响应标头。

响应代码

代码 说明
200 提取容器 URL。
401 授权失败。 访问密钥不正确。
403 请求被拒绝,因为未为 SKU 启用功能。 升级到标准。

有关状态代码的信息,请参阅 状态和错误代码

响应头

无。

响应正文

成功后,将返回 Azure 存储容器 URL,其中包含身份验证令牌。

例如:

https://pushpnsfb5702abf7f71e31.blob.core.windows.net/00000000000297200840?sv=2014-02-14&sr=c&sig=XXxxxxxxxxxxxxx%xxxx%2xxxxxxxxxxxxxxxxxxxxxxxxxx%3D&se=2015-05-01T00%3A00%3A22Z&sp=rl

然后,可以使用返回的 URL 导航容器并使用 Azure 存储服务 REST API 提取内容

下面显示了示例 PNS 反馈,该反馈指示与两个不同的通知消息 ID 关联的 WNS 过期通道:

<EnumerationResults ServiceEndpoint="---Removed---" ContainerName="00000000002001061088">
  <Blobs>
    <Blob>
      <Name>07272016</Name>
      <Properties>
        <Last-Modified>Wed, 27 Jul 2016 20:57:07 GMT</Last-Modified>
        <Etag>---Removed---</Etag>
        <Content-Length>7150</Content-Length>
        <Content-Type>application/octet-stream</Content-Type>
        <Content-Encoding />
        <Content-Language />
        <Content-MD5 />
        <Cache-Control />
        <Content-Disposition />
        <BlobType>BlockBlob</BlobType>
        <LeaseStatus>unlocked</LeaseStatus>
        <LeaseState>available</LeaseState>
      </Properties>
    </Blob>
  </Blobs>
  <NextMarker />
</EnumerationResults>

Get Blob named : 07272016

<?xml version="1.0" encoding="utf-16"?>
<PnsFeedback xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
  <FeedbackTime>2016-07-27T20:47:10.8905532Z</FeedbackTime>
  <NotificationSystemError>ExpiredChannel</NotificationSystemError>
  <Platform>windows</Platform>
  <PnsHandle>---Removed---</PnsHandle>
  <NotificationId>215e3aba529b49da9b6d35c134147952-20160727204710-2001061088-1</NotificationId>
</PnsFeedback>

<?xml version="1.0" encoding="utf-16"?>
<PnsFeedback xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
  <FeedbackTime>2016-07-27T20:56:34.1588971Z</FeedbackTime>
  <NotificationSystemError>ExpiredChannel</NotificationSystemError>
  <Platform>windows</Platform>
  <PnsHandle>---Removed---</PnsHandle>
  <NotificationId>82d1e0626bd14221be7298341ae9a7b3-20160727205634-2001061088-1</NotificationId>
</PnsFeedback>

示例代码

azure-notificationhubs-samples GitHub 存储库中提供了演示此 REST API 的示例代码。