GET /admin/webhooks.json returns 一个空数组
GET /admin/webhooks.json returns an empty array
当执行 GET /admin/webhooks.json 时,它只是 returns:
{"webhooks"=>[]}
我已经使用管理面板创建了 8 个 webhook,但我似乎无法使用 API 访问它们。如果我直接在浏览器中输入 https://SHOP_NAME.myshopify.com/admin/webhooks.json,它会 return 所有 webhooks。
这是我使用私人应用程序的凭据进行的调用:
require 'httparty'
data = HTTParty.get("https://<API_KEY>:<PASSWORD>@<SHOP_NAME>.myshopify.com/admin/webhooks.json", :headers => {'Content-Type' => 'application/json'})
知道我做错了什么吗?
支持https://<API_KEY>:<PASSWORD>@...
形式的Shopify API authentication docs doesn't give any indication that HTTP basic authentication扫描
这可能是你查询不到钩子的原因。在您的浏览器中,您可以使用网络会话。您可以通过从 url 中删除基本身份验证并在浏览器中再次打开来验证
https://<SHOP_NAME>.myshopify.com/admin/webhooks.json
/admin/webhooks.json 端点仅 returns 您已使用该 API 密钥注册的 webhook。这就是为什么我看到一个空数组。
当执行 GET /admin/webhooks.json 时,它只是 returns:
{"webhooks"=>[]}
我已经使用管理面板创建了 8 个 webhook,但我似乎无法使用 API 访问它们。如果我直接在浏览器中输入 https://SHOP_NAME.myshopify.com/admin/webhooks.json,它会 return 所有 webhooks。
这是我使用私人应用程序的凭据进行的调用:
require 'httparty'
data = HTTParty.get("https://<API_KEY>:<PASSWORD>@<SHOP_NAME>.myshopify.com/admin/webhooks.json", :headers => {'Content-Type' => 'application/json'})
知道我做错了什么吗?
支持https://<API_KEY>:<PASSWORD>@...
形式的Shopify API authentication docs doesn't give any indication that HTTP basic authentication扫描
这可能是你查询不到钩子的原因。在您的浏览器中,您可以使用网络会话。您可以通过从 url 中删除基本身份验证并在浏览器中再次打开来验证
https://<SHOP_NAME>.myshopify.com/admin/webhooks.json
/admin/webhooks.json 端点仅 returns 您已使用该 API 密钥注册的 webhook。这就是为什么我看到一个空数组。