Deleting Webhooks

怎甘沉沦 提交于 2019-12-13 03:37:28

问题


I have a shop with permission to read|write both orders and products. I setup some Webhooks and now I want to delete them. I am getting back 401 errors.

Starting with 4 webhooks
Trying to delete webhook 1982492
Error nil, Failed.  Response code = 401.  Response message = Unauthorized.
Trying to delete webhook 1982494
Error nil, Failed.  Response code = 401.  Response message = Unauthorized.
Trying to delete webhook 1982496
Error nil, Failed.  Response code = 401.  Response message = Unauthorized.
Trying to delete webhook 1982498
Error nil, Failed.  Response code = 401.  Response message = Unauthorized.
Ended with 4 webhooks

So, how does one delete Webhooks set on products and orders?


回答1:


Here’s a conversation with my Shopify console to show it working correctly:

$ shopify console
using iliketurtles.myshopify.com
irb(main):001:0> include ShopifyAPI
=> Object
irb(main):002:0> w = Webhook.create topic: "orders/create", address: "http://whatever.place.com", format: "json"
=> #<ShopifyAPI::Webhook:0x007f8ff1895778 @attributes={"topic"=>"orders/create", "address"=>"http://whatever.place.com", "format"=>"json", "id"=>2026848, "created_at"=>"2012-08-10T15:11:25-04:00", "updated_at"=>"2012-08-10T15:11:25-04:00"}, @prefix_options={}, @persisted=true, @remote_errors=nil, @validation_context=nil, @errors=#<ActiveResource::Errors:0x007f8ff18948c8 @base=#<ShopifyAPI::Webhook:0x007f8ff1895778 ...>, @messages={}>>
irb(main):003:0> w.destroy
=> #<Net::HTTPOK 200 OK readbody=true>

As others have mentioned, I think your issue is permissions related.




回答2:


Webhooks (and ScriptTags) that are created by an app are automatically removed when the app is uninstalled. It looks like that might be what is happening here.

If you are doing this in response to an app/uninstalled webhook, there is no reason. It's already handled!




回答3:


If you remove the endpoint that the webhook connects to, it will be deleted after 19 attempts to connect to it.

From the shopify docs (http://wiki.shopify.com/WebHook#Automatic_Retries_and_Deletion)

If an error is returned or a timeout occurs when sending a webhook, Shopify will retry the same request for 48 hours using an exponential back-off approach. In total 19 attempts will be made to deliver the information.

You can also just delete the app, it will remove the webhooks



来源:https://stackoverflow.com/questions/11747299/deleting-webhooks

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!