取得針對性供應項目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. 如需詳細資訊,請參閱使用 Microsoft Store 服務管理針對性優惠For more information, see Manage targeted offers using Store services.

必要條件Prerequisites

若要使用此方式,您需要先為您的 app 目前已登入的使用者取得 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
AuthorizationAuthorization 字串string 必要。Required. 目前已登入的使用者在表單中的應用程式的 Microsoft 帳戶語彙基元持有人 <語彙基元>。The Microsoft Account token for the current signed-in user of your app in the form Bearer <token>.

要求參數Request parameters

這個方法沒有 URI 或查詢參數。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 附加元件的產品識別碼陣列,這些附加元件與適用於目前使用者的針對性優惠相關聯。An array of product IDs for the add-ons that are associated with the targeted offers that are available for the current user. 這些產品識別碼中指定為目標的供應項目在合作夥伴中心內的應用程式頁面。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"
  }
]