Create Webhook Bad Request

Create Webhook Bad Request

Robert39
Shopify Partner
120 0 4

Hello everyone,

I have been using the API to create Blogs and other entities from localhost. I'm trying to create a webhook but no matter the type of webhook. i'm getting "The remote server returned an error: (400) Bad Request". I'm not using a test or locahost address when I try to create the webhook but it still gives me "BadRequest"

I have even tried to post the example api JSON. Any ideas? 

{ 
 "webhook": {
    "topic": "products/creation",
    "address": "http://whatever.hostname.com";,
    "format": "json"
  }
}

 

 

- there is no spoon... webmaster at betterbuiltcode dot COM
Replies 7 (7)

Chris_Saunders
Shopify Staff
591 0 53

What was your API client ID? Also, did you request the correct permissions when the application was installed (only relevant if not a private app)?

Chris | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Robert39
Shopify Partner
120 0 4
Hey Chris, thanks for the response. I actually resolved it a little earlier. The problem was a trailing / at the end of my address property of the Web hook. Everything seems to be fine now. On a side note, is it possible to see webhooks in the admin screen when created via the api? Also when I ask for webhooks, does the api return all webhooks or only those that the calling application has created?
- there is no spoon... webmaster at betterbuiltcode dot COM

Chris_Saunders
Shopify Staff
591 0 53

Webhooks created via API are not displayed. This is to prevent merchants from possibly sabotaging your app by mistake.

Getting the list of webhooks only shows you your webhooks. Again to prevent apps/merchants from sabotaging 🙂

Chris | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Robert39
Shopify Partner
120 0 4
Awesome, great to know! Thanks again.
- there is no spoon... webmaster at betterbuiltcode dot COM

Robert39
Shopify Partner
120 0 4
Hi Chris, I have been doing a little more research in the docs. I stumbled on the events section at http://docs.shopify.com/api/event I'm a little confused about what the main reason for implementing webhooks versus using events. Are events intended to be used as a lighter weight version of a webhook? And events are designed to be polled rather than sent out by Shopify when they are triggered?
- there is no spoon... webmaster at betterbuiltcode dot COM

Chris_Saunders
Shopify Staff
591 0 53

So you'd pull in events - 1 request

You'd pull in each item relevant to your events - n requests

You hit your API limit and spend eternity catching up

Webhooks are asynchronous and allow shopify to send you the data as it happens. Your application spends no time "catching up" which means you are able to handle the data whenever it's most relevant. Also an added benefit is your system doesn't get completely rocked and useless because it's 5 hours out of date and your customer needs the data now.

Chris | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Robert39
Shopify Partner
120 0 4
Ah ok I understand.. Definitely less than optimal.. Thanks
- there is no spoon... webmaster at betterbuiltcode dot COM