2013-09-27 15 views
2

我使用eBay的API,我試圖收到以下通知:的eBay API平臺通知 - 我沒有收到所有我想要的那些

  • ItemSold
  • FixedPriceTransaction
  • EndOfAuction

但是,我收到的唯一通知是'FixedPriceTransaction'。

我使用「設置」我收到什麼通知,該代碼如下所示:

$opts = array(
     'ApplicationDeliveryPreferences' => array(
      'ApplicationEnable' => 'Enable', 
      'ApplicationURL'  => 'http://my.domain/ebay_notifications.php', 
     ), 
     'UserDeliveryPreferenceArray' => array(
      'NotificationEnable' => array(
       'EventType' => 'ItemSold', 
       'EventEnable' => 'Enable' 
      ), 
      'NotificationEnable' => array(
       'EventType' => 'EndOfAuction', 
       'EventEnable' => 'Enable' 
      ), 
      'NotificationEnable' => array(
       'EventType' => 'FixedPriceTransaction', 
       'EventEnable' => 'Enable' 
      )  
     ) 
    ); 

任何想法,我做錯了嗎?

+0

你能發送你用來訂閱ebay事件的整個代碼嗎?他們的API非常混亂,可以節省我數小時的時間。我的信息在我的個人資料上。 – phadaphunk

回答

2

我的帳戶上的小學生錯誤。 「UserDeliveryPreferanceArray」數組包含多個數組。

他們都具有相同的密鑰的標題:「NotificationEnable」

這意味着僅使用最後一個 - 包含「FixedPriceNotification」事件中的一個。

爲了解決這個問題,使索引數組的每個「通知事件」的一部分:

'NotificationEnable' => array(

       1 => array(
        'EventType' => 'ItemSold', 
        'EventEnable' => 'Enable' 
       ), 

       2 => array(
        'EventType' => 'EndOfAuction', 
        'EventEnable' => 'Enable' 
       ), 

       3 => array(
        'EventType' => 'FixedPriceTransaction', 
        'EventEnable' => 'Enable' 
       ) 
      ) 

快樂的日子。

1

好吧,也許我錯了,但工作代碼應該是:

$opts = array(
    'ApplicationDeliveryPreferences' => array(
     'ApplicationEnable' => 'Enable', 
     'ApplicationURL'  => 'http://my.domain/ebay_notifications.php', 
    ), 

     'NotificationEnable' => array(

      1 => array(
       'EventType' => 'ItemSold', 
       'EventEnable' => 'Enable' 
      ), 

      2 => array(
       'EventType' => 'AskSellerQuestion', 
       'EventEnable' => 'Enable' 
      ), 

      3 => array(
       'EventType' => 'FixedPriceTransaction', 
       'EventEnable' => 'Enable' 
      ) 

    ) 
); 

並沒有像我想:

$opts = array(
    'ApplicationDeliveryPreferences' => array(
     'ApplicationEnable' => 'Enable', 
     'ApplicationURL'  => 'http://my.domain/ebay_notifications.php', 
    ), 
    'UserDeliveryPreferenceArray' => array(
     'NotificationEnable' => array(

      1 => array(
       'EventType' => 'ItemSold', 
       'EventEnable' => 'Enable' 
      ), 

      2 => array(
       'EventType' => 'EndOfAuction', 
       'EventEnable' => 'Enable' 
      ), 

      3 => array(
       'EventType' => 'FixedPriceTransaction', 
       'EventEnable' => 'Enable' 
      ) 
     ) 
); 

第一個似乎運作良好這麼久。最後一個生成37錯誤。 謝謝你的巨大建議。

相關問題