通过 ShopifyAPI 注册 Shopify Webhook gem
Registering a Shopify Webhook via the ShopifyAPI gem
这个调用正确returns一个空数组:
hooks = ShopifyAPI::Session.temp(s.myshopify_domain, s.shopify_access_token) do
ShopifyAPI::Webhook.find :all
end
虽然此调用总是 returns 403:
hook = ShopifyAPI::Session.temp(s.myshopify_domain, s.shopify_access_token) do
ShopifyAPI::Webhook.create(
format: 'json',
topic: 'orders/fulfilled',
address: "http://www.something.fr/api/webhooks?store_id=#{s.id }&store_check=#{ s.checksum }"
)
end
我几乎尝试了各种网站提供的所有解决方案,但每次都失败了。
我在这里错过了什么?
试试这个
hook = ShopifyAPI::Session.temp(s.myshopify_domain, s.shopify_access_token) do
ShopifyAPI::Webhook.new(
format: 'json',
topic: 'orders/fulfilled',
address: "http://www.something.fr/api/webhooks?store_id=#{s.id }&store_check=#{ s.checksum }"
)
end
可能重复:Error Creating Shopify Webhook through the API
原文给出的整个代码块post是正确的。
这实际上是一个权限问题,向我们提供 API 令牌的客户没有在 Shopify 配置上启用 webhook 创建权限。
这可能看起来没什么,但重要的是你要和给你凭据的人核实一下!
这个调用正确returns一个空数组:
hooks = ShopifyAPI::Session.temp(s.myshopify_domain, s.shopify_access_token) do
ShopifyAPI::Webhook.find :all
end
虽然此调用总是 returns 403:
hook = ShopifyAPI::Session.temp(s.myshopify_domain, s.shopify_access_token) do
ShopifyAPI::Webhook.create(
format: 'json',
topic: 'orders/fulfilled',
address: "http://www.something.fr/api/webhooks?store_id=#{s.id }&store_check=#{ s.checksum }"
)
end
我几乎尝试了各种网站提供的所有解决方案,但每次都失败了。
我在这里错过了什么?
试试这个
hook = ShopifyAPI::Session.temp(s.myshopify_domain, s.shopify_access_token) do
ShopifyAPI::Webhook.new(
format: 'json',
topic: 'orders/fulfilled',
address: "http://www.something.fr/api/webhooks?store_id=#{s.id }&store_check=#{ s.checksum }"
)
end
可能重复:Error Creating Shopify Webhook through the API
原文给出的整个代码块post是正确的。 这实际上是一个权限问题,向我们提供 API 令牌的客户没有在 Shopify 配置上启用 webhook 创建权限。
这可能看起来没什么,但重要的是你要和给你凭据的人核实一下!