1

我正在按照此处的说明http://developer.bigcommerce.com/api/webhooks/quickstart设置 webhook 以启动一些第三方订单处理。我们一直在每小时批量执行此操作,实时 webhook 触发器将为我们节省大量延迟时间。

我想我已经设置了 webhook 广播器,但看不到任何证据表明它被解雇了——我创建了一堆新订单,但没有任何东西到达 rails 服务器。

如何判断 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]"
}

订阅了 store/events/listener 的 webhook:

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"
}
4

1 回答 1

0

我撒了谎。问题显然是试图使用https而不是http. 一切都按预期工作。

此外,BigCommerce 提供了一个钩子来检查给定应用程序的活动客户端:

curl -XGET -H 
  'X-Auth-Client: [BigCommerceAppClientId]' -H 
  'X-Auth-Token: [BigCommerceAppSecret]' 
https://hooks-beta.bigcommerce.com/producer/store/[myStoreKey]
于 2013-06-27T23:10:04.203 回答