Creating Orders using REST APIs

Solved
hulkapps
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?

Accepted Solution (1)

Accepted Solutions
Jason
Shopify Expert
10438 168 2081

This is an accepted solution.

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.

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.
Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.
★ http://freakdesign.com.au ★

View solution in original post

Replies 7 (7)
Jason
Shopify Expert
10438 168 2081

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.

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.
Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.
★ http://freakdesign.com.au ★
hulkapps
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.

hulkapps
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?

hulkapps
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."}}}

Jason
Shopify Expert
10438 168 2081

This is an accepted solution.

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.

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.
Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.
★ http://freakdesign.com.au ★

View solution in original post

hulkapps
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.

tabontech123
New Member
3 0 0

What is order creation limit for live store ?