Reputation: 7123
I've gone through the two step oAuth process to get a long lived access token. I can validate that the access token is valid by successfully making several API calls with cURL...
curl -XGET
-H 'X-Auth-Client: xxxxxxxxxxxxxxxxxxx'
-H 'X-Auth-Token: xxxxxxxxxxxxxxxxxxx'
https://api.bigcommerce.com/stores/xxxxx/v2/products
...returns the store products as expected. Provisioning webhooks returns results as expected. However requesting the list of webhooks:
curl -XGET
-H 'X-Auth-Client: xxxxxxxxxxxxxxxxxxx'
-H 'X-Auth-Token: xxxxxxxxxxxxxxxxxxx'
https://api.bigcommerce.com/stores/xxxxx/v2/hooks
Yields {"error":"Authorization Error."}
The token is for the store owner. The store owner has all visible permissions enabled in the admin interface, and as stated above has the ability to provision new webhooks.
Is there a separate permissions somewhere to enable listing webhooks? Is the BigCommerce API just buggy?
Upvotes: 1
Views: 1181
Reputation: 7123
The Authorization Error.
is a misleading error message. The problem is actually just that I needed to explicitly set the accept header on the curl request:
curl -XGET
-H 'X-Auth-Client: xxxxxxxxxxxxxxxxxxx'
-H 'X-Auth-Token: xxxxxxxxxxxxxxxxxxx'
-H 'Accept: application/json'
https://api.bigcommerce.com/stores/xxxxx/v2/hooks
Yields the expected results.
Upvotes: 2