Recommendations API 関数一覧

オペレーション 概要
GetLastUpdatedTimeForRecommendations 各カテゴリー毎に最新の推奨情報があれば、最新の時刻を取得します。
ListRecommendations カテゴリーの最新情報の一覧を取得します。
ListRecommendationsByNextToken カテゴリーの最新情報が多い場合、次の一覧を取得します。
GetStatusService サービスの動作ステータスを取得します。

Recommendations API 関数利用例

private void btnGetLastUpdatedTimeForRecommendations_Click(object sender, RoutedEventArgs e)
{
    string SellerId = CommonValue.strMerchantId;
    string MarketplaceId = CommonValue.strMarketplaceId;
    string AccessKeyId = CommonValue.strAccessKeyId;
    string SecretKeyId = CommonValue.strSecretKeyId;
    string ApplicationVersion = CommonValue.strApplicationVersion;
    string ApplicationName = CommonValue.strApplicationName;
    string MWSAuthToken = CommonValue.strMWSAuthToken;
    string strbuff = string.Empty;
 
 
    MWSRecommendationsSectionServiceConfig config = new MWSRecommendationsSectionServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSRecommendationsSectionServiceClient client = new MWSRecommendationsSectionServiceClient(
                                                        AccessKeyId,
                                                        SecretKeyId,
                                                        ApplicationName,
                                                        ApplicationVersion,
                                                        config);
    GetLastUpdatedTimeForRecommendationsRequest request = new GetLastUpdatedTimeForRecommendationsRequest();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
    GetLastUpdatedTimeForRecommendationsResponse response = client.GetLastUpdatedTimeForRecommendations(request);
    if (response.IsSetGetLastUpdatedTimeForRecommendationsResult())
    {
        strbuff += "在庫情報更新日付:" + response.GetLastUpdatedTimeForRecommendationsResult.InventoryRecommendationsLastUpdated.Date.ToString() + System.Environment.NewLine;
        strbuff += "セレクション情報更新日付:" + response.GetLastUpdatedTimeForRecommendationsResult.SelectionRecommendationsLastUpdated.Date.ToString() + System.Environment.NewLine;
        strbuff += "価格情報更新日付:" + response.GetLastUpdatedTimeForRecommendationsResult.PricingRecommendationsLastUpdated.Date.ToString() + System.Environment.NewLine;
        strbuff += "広告情報更新日付:" + response.GetLastUpdatedTimeForRecommendationsResult.AdvertisingRecommendationsLastUpdated.Date.ToString() + System.Environment.NewLine;
        strbuff += "海外出品情報更新日付:" + response.GetLastUpdatedTimeForRecommendationsResult.GlobalSellingRecommendationsLastUpdated.Date.ToString() + System.Environment.NewLine;
    }
    txtGetLastUpdatedTimeForRecommendations.Text = strbuff;
}

private void btnListRecommendations_Click(object sender, RoutedEventArgs e)
{
    string SellerId = CommonValue.strMerchantId;
    string MarketplaceId = CommonValue.strMarketplaceId;
    string AccessKeyId = CommonValue.strAccessKeyId;
    string SecretKeyId = CommonValue.strSecretKeyId;
    string ApplicationVersion = CommonValue.strApplicationVersion;
    string ApplicationName = CommonValue.strApplicationName;
    string MWSAuthToken = CommonValue.strMWSAuthToken;
    string strbuff = string.Empty;
 
 
    MWSRecommendationsSectionServiceConfig config = new MWSRecommendationsSectionServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSRecommendationsSectionServiceClient client = new MWSRecommendationsSectionServiceClient(
                                                        AccessKeyId,
                                                        SecretKeyId,
                                                        ApplicationName,
                                                        ApplicationVersion,
                                                        config);
    ListRecommendationsRequest request = new ListRecommendationsRequest();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
    request.RecommendationCategory = "Inventory";
 
    // 処理実行
    ListRecommendationsResponse response = client.ListRecommendations(request);
    if (response.IsSetListRecommendationsResult())
    {
        List<InventoryRecommendation> inventoryRecommendations = response.ListRecommendationsResult.InventoryRecommendations;
        foreach (InventoryRecommendation inventoryRecommendation in inventoryRecommendations)
        {
            strbuff += "商品名:" + inventoryRecommendation.ItemName + " 更新日:" + inventoryRecommendation.LastUpdated.Date.ToString() + System.Environment.NewLine;
        }
    }
    txtListRecommendations.Text = strbuff;
}

private void btnListRecommendationsByNextToken_Click(object sender, RoutedEventArgs e)
{
    string SellerId = CommonValue.strMerchantId;
    string MarketplaceId = CommonValue.strMarketplaceId;
    string AccessKeyId = CommonValue.strAccessKeyId;
    string SecretKeyId = CommonValue.strSecretKeyId;
    string ApplicationVersion = CommonValue.strApplicationVersion;
    string ApplicationName = CommonValue.strApplicationName;
    string MWSAuthToken = CommonValue.strMWSAuthToken;
    string strbuff = string.Empty;
 
 
    MWSRecommendationsSectionServiceConfig config = new MWSRecommendationsSectionServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSRecommendationsSectionServiceClient client = new MWSRecommendationsSectionServiceClient(
                                                        AccessKeyId,
                                                        SecretKeyId,
                                                        ApplicationName,
                                                        ApplicationVersion,
                                                        config);
    ListRecommendationsRequest request = new ListRecommendationsRequest();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
    request.RecommendationCategory = "Inventory";
 
    ListRecommendationsResponse response = client.ListRecommendations(request);
    if (response.IsSetListRecommendationsResult())
    {
        if (response.ListRecommendationsResult.NextToken != null)
        {
            ListRecommendationsByNextTokenRequest request1 = new ListRecommendationsByNextTokenRequest();
            request1.SellerId = SellerId;
            request1.NextToken = response.ListRecommendationsResult.NextToken;
 
            ListRecommendationsByNextTokenResponse response1 = client.ListRecommendationsByNextToken(request1);
            if (response1.IsSetListRecommendationsByNextTokenResult())
            {
                List<InventoryRecommendation> inventoryRecommendations = response.ListRecommendationsResult.InventoryRecommendations;
                foreach (InventoryRecommendation inventoryRecommendation in inventoryRecommendations)
                {
                    strbuff += "商品名:" + inventoryRecommendation.ItemName + " 更新日:" + inventoryRecommendation.LastUpdated.Date.ToString() + System.Environment.NewLine;
                }
            }
        }
    }
    txtListRecommendationsByNextToken.Text = strbuff;
}

private void btnGetServiceStatus_Click(object sender, RoutedEventArgs e)
{
    string SellerId = CommonValue.strMerchantId;
    string MarketplaceId = CommonValue.strMarketplaceId;
    string AccessKeyId = CommonValue.strAccessKeyId;
    string SecretKeyId = CommonValue.strSecretKeyId;
    string ApplicationVersion = CommonValue.strApplicationVersion;
    string ApplicationName = CommonValue.strApplicationName;
    string MWSAuthToken = CommonValue.strMWSAuthToken;
    string strbuff = string.Empty;
 
 
    MWSRecommendationsSectionServiceConfig config = new MWSRecommendationsSectionServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSRecommendationsSectionServiceClient client = new MWSRecommendationsSectionServiceClient(
                                                        AccessKeyId,
                                                        SecretKeyId,
                                                        ApplicationName,
                                                        ApplicationVersion,
                                                        config);
    GetServiceStatusRequest request = new GetServiceStatusRequest();
    request.SellerId = SellerId;
    request.MWSAuthToken = MWSAuthToken;
 
    GetServiceStatusResponse response = client.GetServiceStatus(request);
    if (response.IsSetGetServiceStatusResult())
    {
        strbuff = "サービス状態:" + response.GetServiceStatusResult.Status; 
    }
    txtGetServiceStatus.Text = strbuff;
}