Product update using REST-API

Product update using REST-API

5 0 1

The challenge is to update shop entities after previous inserts.

We follow this procedure:

  • insert a product by passing a complex product object to the shop using the REST-API. The product object among others contains metafields, variants, variant-metafields, a variant image and product images.
  • for all those entities we retrieve the shopify id that was assigned during the insert process and write them into our local product database
  • when trying to open entities (like product or product variant) using this shopify id by adding it as URL-parameter, it works well. This shows that the IDs haven been retrieved correctly.
  • when trying to update the product using these shopify-IDs, it normally works well, but often we get the error that the entity (one of many within the product object) cannot be found. What we do is to pass a complete product object (with product id) containing product metafields (with all the product metafield IDs), with product variants (with their product variant IDs), the product variant metafields (with all their metafield IDs), and so on.
  • When analyzing the update error, it often turns out that it is a metafield ID that cannot be found even though the metafields are inserted correctly (the product ID is normally not the problem).

The insert process is almost 100% reliable. As workaround, we now have to delete all products so we can use the insert process rather than the update process which is not reliable.


What can be done to update products (with all those properties, namely metafields) in a reliable way? The reason for us to use a complex product object with all properties is to avoid error 429 - too many requests.

What is the recommended way for feeding Shopify from an ERP system using the REST-API?

Thanks a lot.



Replies 2 (2)

Shopify Partner
1033 86 287

If after the fact you can verify that the metafield ID's are indeed valid and have data, I'm wondering how long after the initial insert are you then making the update request. Sometimes it can take a little while until you can reference all of the new record ID's in order to pull their data. If there is a rapid insert/update routine, can you create a small test case, and insert say a 5-second pause between the insert and the update? Does this alleviate the quirk? 

5 0 1

Thanks for the reply!

yes, I am aware of the delay for the accessability of a given id after it was created. You suggest a pause of some seconds, I will give it it try.