获取定向优惠Get targeted offers

使用此方法来获取为当前用户提供的定向优惠,具体取决于用户是否属于该定向优惠所针对的客户细分的一部分。Use this method to get the targeted offers that are available for the current user, based on whether or not the user is part of the customer segment for the targeted offer. 有关更多信息,请参阅使用应用商店服务管理定向优惠For more information, see Manage targeted offers using Store services.

必备条件Prerequisites

若要使用此方法,你需要先为当前已登录应用的用户获取 Microsoft 帐户令牌To use this method, you need to first obtain a Microsoft Account token for the current signed-in user of your app. 对于此方法,你必须将此令牌传递至 Authorization 请求标头中。You must pass this token in the Authorization request header for this method. 此令牌供 Microsoft Store 用于为当前用户提供定向优惠。This token is used by the Store to get targeted offers for the current user.

请求Request

请求语法Request syntax

方法Method 请求 URIRequest URI
GETGET https://manage.devcenter.microsoft.com/v2.0/my/storeoffers/user

请求头Request header

标头Header 在任务栏的搜索框中键入Type 描述Description
授权Authorization 字符串string 必需。Required. 在窗体应用程序的当前登录的用户的 Microsoft 帐户令牌持有者 <令牌>。The Microsoft Account token for the current signed-in user of your app in the form Bearer <token>.

请求参数Request parameters

此方法没有 UI 或查询参数。This method has no URI or query parameters.

请求示例Request example

GET https://manage.devcenter.microsoft.com/v2.0/my/storeoffers/user HTTP/1.1
Authorization: Bearer <Microsoft Account token>

响应Response

此方法将会返回一个 JSON 格式的响应正文,其中包含一个对象数组及以下字段。This method returns a JSON-formatted response body that contains an array of objects with the following fields. 数组中的每个对象代表为指定用户(特定客户细分的一部分)提供的定向优惠。Each object in the array represents the targeted offers that are available for the specified user as part of a particular customer segment.

字段Field 在任务栏的搜索框中键入Type 描述Description
offersoffers 数组array 与针对当前用户提供的定向优惠关联的加载项产品 ID 数组。An array of product IDs for the add-ons that are associated with the targeted offers that are available for the current user. 中指定这些产品 Id针对产品/服务在合作伙伴中心应用程序页。These product IDs are specified in the Targeted offers page for your app in Partner Center.
trackingIdtrackingId 字符串string 一个 GUID,可在你自己的代码或服务中选择用来跟踪定向优惠。A GUID that you can optionally use to keep track of the targeted offer in your own code or services.

示例Example

以下示例举例说明此请求的 JSON 响应正文。The following example demonstrates an example JSON response body for this request.

[
  {
    "offers": [
      "10x gold coins",
      "100x gold coins"
    ],
    "trackingId": "5de5dd29-6dce-4e68-b45e-d8ee6c2cd203"
  }
]