Subscriptions API 関数概要

処理フロー

  • 1 ステップ1
  • 2 ステップ2
  • 3 ステップ3
  • 4 ステップ4
Step 利用関数 処理概要
ステップ1 Amazon SQS 通知受信用にAmazon SQSにキューを作成します。
ステップ2 RegisterDestination 通知を受信する配信先を登録します。
ステップ3 SendTestNotificationToDestination 配信先への送信テストを行います。
ステップ4 CreateSubscription 新しい配信先へのサブスクリプションを作成します。

Subscriptions API 関数一覧

オペレーション 概要
RegisterDestination 新しい配信先を登録します。
DeregisterDestination 登録済配信先情報を削除します。
ListRegisteredDestinations 登録済配信先一覧を取得します。
SendTestNotificationToDestination 登録済配信先へのテスト通知を実行します。
CreateSubscription 配信先への通知登録を行います。
GetSubscription 配信先への通知情報を取得します。
DeleteSubscription 配信先への通知情報を削除します。
ListSubscriptions 配信先への通知情報を一覧で取得します。
UpdateSubscription 配信先への通知情報を更新します。

Subscriptions API 関数利用例

private void btnRegisterDestination_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;
 
    MWSSubscriptionsServiceConfig config = new MWSSubscriptionsServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSSubscriptionsService.MWSSubscriptionsService client = new MWSSubscriptionsServiceClient(
                                                        AccessKeyId,
                                                        SecretKeyId,
                                                        ApplicationName,
                                                        ApplicationVersion,
                                                        config);
    RegisterDestinationInput request = new RegisterDestinationInput();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
 
    Destination destination = new Destination();
    AttributeKeyValueList keyvalueList = new AttributeKeyValueList();
    AttributeKeyValue attributekeyvalue = new AttributeKeyValue();
    attributekeyvalue.Key = "sqsQueueUrl";
    attributekeyvalue.Value = "https://sqs.ap-northeast-1.amazonaws.com/099694714041/A1D8HAM00ATHKF";
    AttributeKeyValueList attKeyValueList = new AttributeKeyValueList();
    attKeyValueList.Member.Add(attributekeyvalue);
    destination.WithAttributeList(attKeyValueList);
    destination.WithDeliveryChannel("SQS");
    request.Destination = destination;
 
    RegisterDestinationResponse response = new RegisterDestinationResponse();
    response = client.RegisterDestination(request);
 
    if (response.IsSetRegisterDestinationResult())
    {
        strbuff = "";
    }
    txtRegisterDestination.Text = strbuff;
}

private void btnDeregisterDestination_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;
 
    MWSSubscriptionsServiceConfig config = new MWSSubscriptionsServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSSubscriptionsService.MWSSubscriptionsService client = new MWSSubscriptionsServiceClient(
                                                        AccessKeyId,
                                                        SecretKeyId,
                                                        ApplicationName,
                                                        ApplicationVersion,
                                                        config);
    DeregisterDestinationInput request = new DeregisterDestinationInput();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
 
    Destination destination = new Destination();
    AttributeKeyValueList KeyValueList = new AttributeKeyValueList();
    AttributeKeyValue attKeyValue = new AttributeKeyValue();
    attKeyValue.Key = "sqsQueueUrl";
    attKeyValue.Value = "https://sqs.ap-northeast-1.amazonaws.com/099694714041/A1D8HAM00ATHKF";
    AttributeKeyValueList attKeyValueList = new AttributeKeyValueList();
    attKeyValueList.Member.Add(attKeyValue);
    destination.WithAttributeList(attKeyValueList);
    destination.WithDeliveryChannel("SQS");
    request.Destination = destination;
 
    DeregisterDestinationResponse response = new DeregisterDestinationResponse();
    response = client.DeregisterDestination(request);
    if (response.IsSetDeregisterDestinationResult())
    {
        strbuff = "正常に削除処理が完了しました。";
    } 
    txtDeregisterDestination.Text = strbuff;
}

private void btnListRegisteredDestinations_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;
 
    MWSSubscriptionsServiceConfig config = new MWSSubscriptionsServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSSubscriptionsService.MWSSubscriptionsService client = new MWSSubscriptionsServiceClient(
                                                        AccessKeyId,
                                                        SecretKeyId,
                                                        ApplicationName,
                                                        ApplicationVersion,
                                                        config);
    ListRegisteredDestinationsInput request = new ListRegisteredDestinationsInput();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
 
    ListRegisteredDestinationsResponse response = new ListRegisteredDestinationsResponse();
    response = client.ListRegisteredDestinations(request);
    if (response.IsSetListRegisteredDestinationsResult())
    {
        foreach (Destination destination in response.ListRegisteredDestinationsResult.DestinationList.Member)
        {
            strbuff += "配信チャネル:" + destination.DeliveryChannel + System.Environment.NewLine;
            strbuff += "URL:" + destination.AttributeList.Member[0].Value.ToString() + System.Environment.NewLine;
        }
    }
    txtListRegisteredDestinations.Text = strbuff;
}

private void btnSendTestNotificationToDestination_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;
 
    MWSSubscriptionsServiceConfig config = new MWSSubscriptionsServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSSubscriptionsService.MWSSubscriptionsService client = new MWSSubscriptionsServiceClient(
                                                        AccessKeyId,
                                                        SecretKeyId,
                                                        ApplicationName,
                                                        ApplicationVersion,
                                                        config);
    SendTestNotificationToDestinationInput request = new SendTestNotificationToDestinationInput();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
 
    Destination destination = new Destination();
    AttributeKeyValueList keyvalueList = new AttributeKeyValueList();
    AttributeKeyValue attributekeyvalue = new AttributeKeyValue();
    attributekeyvalue.Key = "sqsQueueUrl";
    attributekeyvalue.Value = "https://sqs.ap-northeast-1.amazonaws.com/099694714041/A1D8HAM00ATHKF";
    AttributeKeyValueList attKeyValueList = new AttributeKeyValueList();
    attKeyValueList.Member.Add(attributekeyvalue);
    destination.WithAttributeList(attKeyValueList);
    destination.WithDeliveryChannel("SQS");
    request.Destination = destination;
 
    SendTestNotificationToDestinationResponse response = new SendTestNotificationToDestinationResponse();
    response = client.SendTestNotificationToDestination(request);
    if (response.IsSetSendTestNotificationToDestinationResult())
    {
        strbuff = "正常処理完了";
    }
    else
    {
        strbuff = "送信処理エラー";
    }
    txtSendTestNotificationToDestination.Text = strbuff;
}

private void btnCreateSubscription_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;
 
    MWSSubscriptionsServiceConfig config = new MWSSubscriptionsServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSSubscriptionsService.MWSSubscriptionsService client = new MWSSubscriptionsServiceClient(
                                                        AccessKeyId,
                                                        SecretKeyId,
                                                        ApplicationName,
                                                        ApplicationVersion,
                                                        config);
    CreateSubscriptionInput request = new CreateSubscriptionInput();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
 
    Subscription subscription = new Subscription();
    Destination destination = new Destination();
 
    AttributeKeyValueList attKeyValueList = new AttributeKeyValueList();
    AttributeKeyValue attKeyValue = new AttributeKeyValue();
    attKeyValue.Key = "sqsQueueUrl";
    attKeyValue.Value = "https://sqs.ap-northeast-1.amazonaws.com/099694714041/A1D8HAM00ATHKF";
    attKeyValueList.Member.Add(attKeyValue);
    destination.WithAttributeList(attKeyValueList);
    destination.WithDeliveryChannel("SQS");
    subscription.NotificationType = "AnyOfferChanged";
    subscription.IsEnabled = true;
    subscription.WithDestination(destination);
    request.Subscription = subscription;
 
    CreateSubscriptionResponse response = new CreateSubscriptionResponse();
    response = client.CreateSubscription(request);
    if (response.IsSetCreateSubscriptionResult())
    {
        strbuff = "処理が正常に完了しました。";
    } else {
        strbuff = "処理途中にエラーが発生しました。";
    }
    txtCreateSubscription.Text = strbuff;
}

private void btnGetSubscription_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;
 
    MWSSubscriptionsServiceConfig config = new MWSSubscriptionsServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSSubscriptionsService.MWSSubscriptionsService client = new MWSSubscriptionsServiceClient(
                                                        AccessKeyId,
                                                        SecretKeyId,
                                                        ApplicationName,
                                                        ApplicationVersion,
                                                        config);
    GetSubscriptionInput request = new GetSubscriptionInput();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
    request.NotificationType = "AnyOfferChanged";
 
    Destination destination = new Destination();
 
    AttributeKeyValueList attKeyValueList = new AttributeKeyValueList();
    AttributeKeyValue attKeyValue = new AttributeKeyValue();
    attKeyValue.Key = "sqsQueueUrl";
    attKeyValue.Value = "https://sqs.ap-northeast-1.amazonaws.com/099694714041/A1D8HAM00ATHKF";
    attKeyValueList.Member.Add(attKeyValue);
    destination.WithAttributeList(attKeyValueList);
    destination.WithDeliveryChannel("SQS");
    request.Destination = destination;
 
    GetSubscriptionResponse response = new GetSubscriptionResponse();
    response = client.GetSubscription(request);
    if (response.IsSetGetSubscriptionResult())
    {
        strbuff = "サブスクリプション情報が見つかりました。";
    }
    else
    {
        strbuff = "サブスクリプション情報が見つかりませんでした。";
    }
    txtGetSubscription.Text = strbuff;
}

private void btnDeleteSubscription_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;
 
    MWSSubscriptionsServiceConfig config = new MWSSubscriptionsServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSSubscriptionsService.MWSSubscriptionsService client = new MWSSubscriptionsServiceClient(
                                                        AccessKeyId,
                                                        SecretKeyId,
                                                        ApplicationName,
                                                        ApplicationVersion,
                                                        config);
    DeleteSubscriptionInput request = new DeleteSubscriptionInput();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.NotificationType = "AnyOfferChanged";
 
    Destination destination = new Destination();
 
    AttributeKeyValueList attKeyValueList = new AttributeKeyValueList();
    AttributeKeyValue attKeyValue = new AttributeKeyValue();
    attKeyValue.Key = "sqsQueueUrl";
    attKeyValue.Value = "https://sqs.ap-northeast-1.amazonaws.com/099694714041/A1D8HAM00ATHKF";
    attKeyValueList.Member.Add(attKeyValue);
    destination.WithAttributeList(attKeyValueList);
    destination.WithDeliveryChannel("SQS");
    request.NotificationType = "AnyOfferChanged";
    request.Destination = destination;
 
    DeleteSubscriptionResponse response = new DeleteSubscriptionResponse();
    response = client.DeleteSubscription(request);
    if (response.IsSetDeleteSubscriptionResult())
    {
        strbuff = "削除処理が正常に完了しました。";
    }
    else
    {
        strbuff = "削除処理でエラーが発生しました。";
    }
    txtDeleteSubscription.Text = strbuff;
}

private void btnListSubscriptions_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;
 
    MWSSubscriptionsServiceConfig config = new MWSSubscriptionsServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSSubscriptionsService.MWSSubscriptionsService client = new MWSSubscriptionsServiceClient(
                                                        AccessKeyId,
                                                        SecretKeyId,
                                                        ApplicationName,
                                                        ApplicationVersion,
                                                        config);
    ListSubscriptionsInput request = new ListSubscriptionsInput();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
 
    ListSubscriptionsResponse response = new ListSubscriptionsResponse();
    response = client.ListSubscriptions(request);
    if (response.IsSetListSubscriptionsResult())
    {
        if (response.ListSubscriptionsResult.SubscriptionList.Member.Count == 0)
        {
            strbuff = "リストが見つかりませんでした。";
        } else
        {
            foreach (Subscription subscription in response.ListSubscriptionsResult.SubscriptionList.Member)
            {
                strbuff += "URL情報:" + subscription.Destination.AttributeList.Member[0].Value + System.Environment.NewLine;
            }
        }
    }
    txtListSubscriptions.Text = strbuff;
}

private void btnUpdateSubscription_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;
 
    MWSSubscriptionsServiceConfig config = new MWSSubscriptionsServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSSubscriptionsService.MWSSubscriptionsService client = new MWSSubscriptionsServiceClient(
                                                        AccessKeyId,
                                                        SecretKeyId,
                                                        ApplicationName,
                                                        ApplicationVersion,
                                                        config);
    UpdateSubscriptionInput request = new UpdateSubscriptionInput();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
 
    Subscription subscription = new Subscription();
    Destination destination = new Destination();
 
    AttributeKeyValueList attKeyValueList = new AttributeKeyValueList();
    AttributeKeyValue attKeyValue = new AttributeKeyValue();
    attKeyValue.Key = "sqsQueueUrl";
    attKeyValue.Value = "https://sqs.ap-northeast-1.amazonaws.com/099694714041/A1D8HAM00ATHKF";
    attKeyValueList.Member.Add(attKeyValue);
    destination.WithAttributeList(attKeyValueList);
    destination.WithDeliveryChannel("SQS");
    subscription.NotificationType = "AnyOfferChanged";
    subscription.IsEnabled = true;
    subscription.WithDestination(destination);
    request.Subscription = subscription;
 
    UpdateSubscriptionResponse response = new UpdateSubscriptionResponse();
    response = client.UpdateSubscription(request);
    if (response.IsSetUpdateSubscriptionResult())
    {
        strbuff = "正常に更新処理が完了しました";
    }
    else
    {
        strbuff = "更新処理に失敗しました。";
    }
    txtUpdateSubscription.Text = strbuff;
}