Re: "Exceeded 2 calls per second for api client" - Please help!

Solved

"Exceeded 2 calls per second for api client" - Please help!

turbot
Tourist
7 0 2

Hi, 

I am publishing products to the shop back office via the API. Unfortunately, I get the following error, when publishing certain variants. Does anyone have experience with this or suggestions for a workaround? 

{
"context": "create-variant",
"message": "Exceeded 2 calls per second for api client. Reduce request rates to resume uninterrupted service.",
"response": {
"errors": "Exceeded 2 calls per second for api client. Reduce request rates to resume uninterrupted service."
}


Is there a way to increase the maximum request, or to queue the request? 

Accepted Solutions (2)

dogowner
Shopify Partner
58 5 8

This is an accepted solution.

Is this during a batch job, like in a script?

 

You might try keeping track of how many requests in the last second and putting the process to sleep.  So you don't get the error.

 

Or try splitting the call into chunks if you can create the product and then create the variant for example.

 

You could also just sleep and re-try the request after getting the limit error.

 

What client api are you using ?

 

I use python mostly with the graphql API and I have to track the throttling myself.  I use time.sleep before I get to the limits.

View solution in original post

uday9989
Visitor
1 1 1

This is an accepted solution.

"created_at": "2022-08-11T08:13:49Z",
"updated_at": "2022-08-11T08:13:49Z",
"created_by": "Dev Application",
"updated_by": "Dev Application",
"external_id": "5457b3ad-fdaa-4e2b-a08c-87ed1f3a96f1",
"data": {
"status_code": 429,
"request_payload": {
"order": {
"total_discounts": "140.0",
"send_receipt": true,
"phone": "+919737755555",
"inventory_behaviour": "bypass",
"financial_status": "paid",
"billing_address": {
"zip": "370201",
"country": "India",
"province": "GUJARAT",
"address2": "Shaktinagar",
"phone": "9737755555",
"city": "Kachchh",
"address1": "Plot No A/66 Nu 10B",
"last_name": "Guwalani",
"first_name": "Santosh"
},
"line_items": [
{
"variant_id": 39532337660001,
"quantity": 1,
"price": "200.0"
}
],
"shipping_address": {
"zip": "370201",
"country": "India",
"province": "GUJARAT",
"address2": "Shaktinagar",
"phone": "9737755555",
"city": "Kachchh",
"address1": "Plot No A/66 Nu 10B",
"last_name": "Guwalani",
"first_name": "Santosh"
},
"transactions": [
{
"amount": "60.0",
"kind": "capture",
"gateway": "CRED",
"status": "success"
}
],
"tags": "CRED"
}
},
"error_string": "{\"errors\":\"Exceeded 2 calls per second for api client. Reduce request rates to resume uninterrupted service.\"}"

View solution in original post

Replies 2 (2)

dogowner
Shopify Partner
58 5 8

This is an accepted solution.

Is this during a batch job, like in a script?

 

You might try keeping track of how many requests in the last second and putting the process to sleep.  So you don't get the error.

 

Or try splitting the call into chunks if you can create the product and then create the variant for example.

 

You could also just sleep and re-try the request after getting the limit error.

 

What client api are you using ?

 

I use python mostly with the graphql API and I have to track the throttling myself.  I use time.sleep before I get to the limits.

uday9989
Visitor
1 1 1

This is an accepted solution.

"created_at": "2022-08-11T08:13:49Z",
"updated_at": "2022-08-11T08:13:49Z",
"created_by": "Dev Application",
"updated_by": "Dev Application",
"external_id": "5457b3ad-fdaa-4e2b-a08c-87ed1f3a96f1",
"data": {
"status_code": 429,
"request_payload": {
"order": {
"total_discounts": "140.0",
"send_receipt": true,
"phone": "+919737755555",
"inventory_behaviour": "bypass",
"financial_status": "paid",
"billing_address": {
"zip": "370201",
"country": "India",
"province": "GUJARAT",
"address2": "Shaktinagar",
"phone": "9737755555",
"city": "Kachchh",
"address1": "Plot No A/66 Nu 10B",
"last_name": "Guwalani",
"first_name": "Santosh"
},
"line_items": [
{
"variant_id": 39532337660001,
"quantity": 1,
"price": "200.0"
}
],
"shipping_address": {
"zip": "370201",
"country": "India",
"province": "GUJARAT",
"address2": "Shaktinagar",
"phone": "9737755555",
"city": "Kachchh",
"address1": "Plot No A/66 Nu 10B",
"last_name": "Guwalani",
"first_name": "Santosh"
},
"transactions": [
{
"amount": "60.0",
"kind": "capture",
"gateway": "CRED",
"status": "success"
}
],
"tags": "CRED"
}
},
"error_string": "{\"errors\":\"Exceeded 2 calls per second for api client. Reduce request rates to resume uninterrupted service.\"}"