Keeping product data up to date

Now that you’ve requested tracking and have verified that you are able to query product information, you need to decide how you want this product information to flow through to your frontend. There are two main strategies for doing this:

  1. Server-side sync (recommended). Under this strategy, you will perform a one-off sync of all products you are tracking with Rye into your own database. After performing the initial data pull, you will keep your copy of the data up to date by receiving webhooks from Rye when product catalog data changes. This option is recommended as it affords you the most control over the data and allows you to query it in a way that is most efficient for your use case.
  2. Client-side queries. Under this strategy, you will query Rye’s API directly from your frontend to retrieve product data. This is simpler, but significantly less flexible.

To implement server-side sync using webhooks, you will need to do the following:

  1. Set up webhooks per our guide.
  2. For Sell Anything API products: handle the PRODUCT_UPDATED webhook event.
  3. For Sync API products: handle the SHOPIFY_PRODUCT_UPDATED and SHOPIFY_PRODUCT_DELETED webhook events. You can find types for these events in our webhooks documentation.

We currently do not fire a webhook when Sell Anything API products are deleted. In order to handle this edge case, you will need to periodically query Rye’s API for products you are tracking and delete them from your database if they are no longer present. Our recommendation is to run this cleanup operation once every six hours.

Rye automatically created subscriptions on your account for updates to products you have requested via the Sell Anything API, and for products inside stores you have integrated with through the Sync API. There is no further work required beyond setting up a webhook endpoint to receive these events.

Client-side queries

Client-side queries can be performed via JWT authentication. This enables your frontend to retrieve data directly from Rye APIs withou the need for any backend infrastructure on your side. This is a good option for rapid prototyping, as there are fewer moving parts to consider.