2013-06-27 74 views
1

聽衆,我按照說明這裏http://developer.bigcommerce.com/api/webhooks/quickstart建立網絡掛接啓動一些第三方訂單處理。我們一直按小時批量處理,實時webhook觸發器將爲我們節省很多時間。的Bigcommerce網絡掛接在軌

我想我已經組建網絡掛接廣播,但無法看到任何證據表明,它正在fired-我創建了一堆新訂單並沒有什麼到達軌道服務器。

我怎樣才能知道的Bigcommerce被觸發事件何時/何我期待?

產生用於給定的應用程序/用戶/域的訪問令牌:

curl -XPOST -d '{ 
    "client_id":"[BigCommerceAppClientId]", 
    "client_secret":"[BigCommerceAppSecret]", 
    "user":"admin", 
    "token":"[adminAPIToken]", 
    "store_domain":"https://[myStore].mybigcommerce.com" 
}' https://hooks-beta.bigcommerce.com/token 

產量===>

{ 
    "access_token":"[webHooksAccessToken]", 
    "producer":"store/[myStoreKey]" 
} 

已訂閱網絡掛接用於存儲/事件/聽衆:

curl -XPOST -d '{ 
    "producer":"store/[myStoreKey]", 
    "scope":"store/order/created", 
    "deliverymethod":"HTTP_POST", 
    "destination":{"url":"http://[myPublicRailsServer]/hooks"} 
}' -H 'X-Auth-Client: [BigCommerceAppClientId]' -H 'X-Auth-Token:[X-Auth-Token]' https://hooks-beta.bigcommerce.com 

收益率===>

{ 
    "client_id":"[webHooksAccessToken]", 
    "created_at":"2013-06-27T19:57:38+00:00", 
    "deliverymethod":"HTTP_POST","destination":{"url":"http://[myPublicRailsServer]/hooks"}, 
    "id":651, 
    "producer":"store/[myStoreKey]", 
    "scope":"store/order/created", 
    "updated_at":"2013-06-27T19:57:38+00:00" 
} 
+0

你是如何處理來自您的軌道服務器這些數據? – Greg

+0

@Greg:我有一個鉤子控制器和每個webhook作用域的路由。 webhook調用是POSTS,因此我將CSRF篩選器切換爲過濾器,以在所有鉤子的標頭中檢查自定義auth令牌。 – RSG

+0

@格雷格FWIW我只是在博客中寫了起來:http://www.dextropy.com/2014/01/connecting-rails-apps-to-bigcommerce.html – RSG

回答

0

我撒謊了。該問題顯然試圖使用https而不是http。一切都按預期工作。

Furthermore-的Bigcommerce提供了一個鉤來檢查活動的客戶端對於給定的應用:

curl -XGET -H 
    'X-Auth-Client: [BigCommerceAppClientId]' -H 
    'X-Auth-Token: [BigCommerceAppSecret]' 
https://hooks-beta.bigcommerce.com/producer/store/[myStoreKey]