Reduce Number of API Calls Required

Highlighted
Shopify Partner
2 0 0

Hi all!

 

I am new to Rails, coming from an intermediate background in PHP. I am trying to create my first shopify app that uses an asynchronous stream to perform backup and restore functions.

 

So far, I'm having no problems with the backup as it's only a few calls to download most of the information, but when it comes time to do an upload, I'm stuck with a long processing time made longer due to the bucket size and leak rate.

 

I was wondering how people get around this and if there is a way to update or create several products in one call?

 

I am using the ShopifyAPI gem, which uses ActiveResource as a base. I am having trouble figuring out how to get it to call asynchronously, but I think I saw posts already about that.

 

Any help is appreciated :)

 

Thanks!

0 Likes
Shopify Partner
73 0 21
Congrats on starting your first app. Can’t wait to see what you’re developing.
Processing multiple calls at one time is one of the more difficult challenges we faced when building Rewind. There’s no way to update multiple items at a time using the REST api. It may be possible using GraphQL.

We’re always looking to hire great developers interested in backups. If you’d like to join us or discuss a possible role at Rewind you can email me at mike at rewind.io.

Mike
Co-Founder, Rewind (Backups for Shopify). Apps: Rewind, Replay (clone and sync Shopify stores).
0 Likes
Shopify Partner
22 1 2

It is not possible to reduce the number of REST API calls than the products that you are creating or updating, as it takes one call to make a post/put request i-e create/update call.

There is not much benefit out of making these calls asynchronously as you will quickly hit the call limit and depending on your production environment you might end up using too many threads. Also depending on your code structure, it might also cause problems in case of an error during a call if your just shooting out calls and not checking response.

You can make use of both REST API and GraphQL, if you think it will help in your system as their call limits are handled separately.

You can update multiple products with GraphQL but will exhaust the limits faster than REST depending on the data being sent through it, when your products have multiple variants and images GraphQL becomes costlier with its dynamic cost as compared to constant cost of REST calls.

0 Likes