Shopify API – Webhook

top

Receive a list of all Webhooks

A webhook’s “topic” attribute determines the event that causes the webhook to send a http POST to the URL set in its “address” attribute.

Available URL Query parameters:

  • limit — Amount of results (default: 50) (maximum: 250)
  • page — Page to show (default: 1)
  • created_at_min — Show webhooks created after date (format: 2008-01-01 03:00)
  • created_at_max — Show webhooks created before date (format: 2008-01-01 03:00)
  • updated_at_min — Show webhooks last updated after date (format: 2008-01-01 03:00)
  • updated_at_max — Show webhooks last updated before date (format: 2008-01-01 03:00)
  • topic — Show webhooks with a given topic
  • address — Show webhooks with a given address
GET /admin/webhooks.xml

Get a list of all webhooks for your shop.

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<webhooks type="array">
  <webhook>
    <address>http://apple.com</address>
    <created-at type="datetime">2010-02-10T14:07:25-05:00</created-at>
    <id type="integer">4759306</id>
    <topic>orders/create</topic>
    <updated-at type="datetime">2010-02-10T14:07:25-05:00</updated-at>
  </webhook>
</webhooks>
top

Receive a count of all Webhooks

Available URL Query parameters:

  • topic — Count webhooks with given topic
  • address — Count webhooks with given address
GET /admin/webhooks/count.xml?topic=orders/create

Get a count of all webhooks for topic 'orders/create'

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<count type="integer">1</count>
GET /admin/webhooks/count.xml

Get a count of all webhooks for your shop.

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<count type="integer">1</count>
top

Receive a single Webhook

Get a single webhook.

GET /admin/webhooks/#{id}.xml

Get a single webhook by its ID.

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<webhook>
  <address>http://apple.com</address>
  <created-at type="datetime">2010-02-10T14:07:25-05:00</created-at>
  <id type="integer">4759306</id>
  <topic>orders/create</topic>
  <updated-at type="datetime">2010-02-10T14:07:25-05:00</updated-at>
</webhook>
top

Create a new Webhook

Create a new webhook by specifying a topic and address

POST /admin/webhooks.xml

After installing a Shopify App, it’s a pain for shop owners to have to manually install webhooks the app needs. Automate that by using this API call.

Request

           
<?xml version="1.0" encoding="UTF-8"?>
<webhook>
  <address>http://whatever.hostname.com</address>
  <topic>orders/create</topic>
</webhook>      

Response

           
HTTP/1.1 201 Created
<?xml version="1.0" encoding="UTF-8"?>
<webhook>
  <address>http://whatever.hostname.com</address>
  <created-at type="datetime">2010-02-10T14:09:47-05:00</created-at>
  <id type="integer">525699910</id>
  <topic>orders/create</topic>
  <updated-at type="datetime">2010-02-10T14:09:47-05:00</updated-at>
</webhook>
top

Modify an existing Webhook

Update a webhook's topic and/or address URIs.

PUT /admin/webhooks/#{id}.xml

Change a webhook so that it POSTs to a different address:

Request

           
<?xml version="1.0" encoding="UTF-8"?>
<webhook>
  <address>http://somewhere-else.com</address>
  <id type="integer">4759306</id>
</webhook>      

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<webhook>
  <address>http://somewhere-else.com</address>
  <created-at type="datetime">2010-02-10T14:07:25-05:00</created-at>
  <id type="integer">4759306</id>
  <topic>orders/create</topic>
  <updated-at type="datetime">2010-02-10T14:09:57-05:00</updated-at>
</webhook>
top

Remove a Webhook from the database

Delete a webhook

DELETE /admin/webhooks/#{id}.xml

Remove an existing webhook from a shop

Response

           
HTTP/1.1 200 OK
Last updated at Feb 2010 Feb:02 PM.