Tutorial
Step 1: Request tracking for products and stores
Rye has three different API operations that can be used to request tracking for products and stores:-
requestAmazonProductByURL
Used to request individual Amazon products. This operation returns aproductId
field which should be stored on your end for the next step. -
requestShopifyProductByURL
Used to request individual Shopify products. This operation returns both acanonicalDomain
andproductId
field, both of which should be stored on your end for use in the next step. -
requestStoreByURL
Used to request entire Shopify stores. This operation returns acanonicalDomain
value which you should keep track of for the next step.
canonicalDomain
and productId
. Both of these fields should be stored on your end, as they are useful for subsequent API operations. canonicalDomain
can be used with productsByDomainV2
, and productId
can be used with productByID
to retrieve information about this product at a later date.
These mutations will add your requested product or store to a queue, and it will eventually be processed by our system. This process can take up to 24 hours, but usually completes within a few minutes. You can verify that the data has pulled through to Rye’s systems by querying for the product.
We have an in depth tutorial on how to track products and stores using the Sell Anything API here.
Step 2: Query product information
After you have requested tracking for a product or store, you can retrieve information using the following API operations:-
productByID
Used to retrieve information about a specific product. This works for both Amazon and Shopify products. You will need aproductId
value here, which you should have stored from Step 1. -
productsByDomainV2
Used to retrieve all products from a specific store. This works for Shopify stores. You will need acanonicalDomain
value here, which you should have stored from Step 1.
productsByDomainV2
—unless you are selling Amazon products—as it allows you to query product data efficiently in bulk as opposed to fetching everything one-by-one. The following GraphQL documents will retrieve information about the Gymshark leggings we requested in Step 1:
Forgot to store the
productId
or canonicalDomain
values from Step 1?You can call the relevant request operation again; requesting the same product or store URL multiple times will only count once towards your API usage limits.id
and title
. Check out the following API reference pages for a complete listing of fields available to query:
Step 3: Keep your 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:- 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.
- 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.
Server-side sync (recommended)
To implement server-side sync using webhooks, you will need to do the following:- Set up webhooks per our guide.
- Handle the
PRODUCT_UPDATED
webhook event.
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.