Credit usage limit

Hi
I am trying to automate certain things in shiphero and for that I am using the graphql api’s but the graphql api gives the following error -
graphQLErrors":[{“code”:30,“message”:“There are not enough credits to perfom the requested operation, which requires 101 credits, but the are only 80 left. In 2 seconds you will have enough credits to perform the operation”,“operation”:“orders”,“request_id”:“5dfa233258626a98b6c943c1”,“required_credits”:101,“remaining_credits”:80,“time_remaining”:“2 seconds”}],“networkError”:null,“message”:“GraphQL error: There are not enough credits to perfom the requested operation, which requires 101 credits, but the are only 80 left. In 2 seconds you will have enough credits to perform the operation”}

I know this is a throttling mechanism which you have but can we increase the credit limit for our account because we will be using these api’s heavily in our workflows.

thanks in advance.

Hello!

Since it’s only a matter of seconds for the credits to refresh to the amount of credits you need to run the query, I would suggest coding a routine that checks the “time_remaining” variable that gets returned and extracts the number from it, and use that in some sort of wait() or sleep() call. If you do that, the credits essentially become limitless, and your query can run until you get all required results.

Jeremy

3 Likes

Hi @siddharth_singh
I did notice you are making many requests at the same time, for example, query orders.
So that might be causing the lack of credits sometimes.
I believe the approach suggested by @jeremyw is super effective!
Let me know if you are still having trouble after giving that a try
Thanks!!