Creating Orders using REST APIs

Solved
Tourist
7 0 0

Hello everyone,

I am migrating orders from one shop to another shop, I have used REST APIs to fetch orders from my source shop and save it on source shop.

It's working fine for 3-4 orders, but while I am trying to migrate 10 orders at a time (one by one in a queue), APIs are throwing 429 throttle error after 5 orders, I don't know why, I have managed bucket limit too, I am making single request on every 500 ms.

I have logged my every API call response too, so far I can't see bucket even increased for 2 calls per second too.


Can anyone help me, what is this happening and how can I fix this?

0 Likes
Highlighted
Shopify Expert
9789 86 1531

Public app? Private app? Errors in the previous requests?

 

Not sure how your app is architected but hopefully you're not just throwing requests every 500ms and hoping for the best. The queue needs to be managed a little better than that.

 

If you really think you're doing everything right, grab the request ID from a very recent failure response and paste that here.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
2 Likes
Tourist
7 0 0

It's public app.

And No there is no error from any requests.

No I am not sending queue to Shopify for all requests, I am making this request this way:

First I have fetched all orders from Shopify (with 250 Limit), so I have all orders in single variable, 

First I am making request to store single order then i am waiting for 500 ms, and again I am making next request to store my next order, and so on..

 

Appreciate your response

Thank you.

0 Likes
Tourist
7 0 0

Hey @Jason 

 

I have got my request log, but I am not able to find 'Request ID' in my log, can you suggest me how can I get this request ID?

0 Likes
Tourist
7 0 0

Hey @Jason 

 

I have found the Request ID 1c94a46a-2502-49e6-b3d4-c0b9fd848224.

I have got this error on this request:

{"errors":{"status":429,"body":{"errors":"Exceeded 0 calls per second for api client. Reduce request rates to resume uninterrupted service."}}}

0 Likes

Success.

Shopify Expert
9789 86 1531

Just sending over a request every 500ms lacks some sanity checks to make sure you really don't exceed rates or run into other resource limit throttles.

Some notes here:
https://help.shopify.com/en/api/reference/rest-admin-api-rate-limits#recommendations

 

Since you talked about creating Orders and you've shared the error response I'll make the bold assumption that this store is an affiliate one - so a dev shop.

 

Hit up the docs for order create:
https://help.shopify.com/en/api/reference/orders/order#create-2019-04

 

There's a note in there:

If you're using this endpoint with a trial or Partner development store, then you can create no more than 5 new orders per minute.

 

So based on your current plan to throw over an order every 500ms you'll hit that quickly.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
1 Like
Tourist
7 0 0

Hey @Jason 

I was aware of order create limit for development and trail stores.

I will handle this limit for creating order with my API.

Thank you very much.

0 Likes