{"repo":"ScreenStaring/shopify_api_retry","free":true,"listed":false,"github":"https://github.com/ScreenStaring/shopify_api_retry","clone":"git clone https://github.com/ScreenStaring/shopify_api_retry.git","description":"Retry a ShopifyAPI request if rate-limited or other errors occur. Works with the REST and GraphQL APIs.","language":"Ruby","stars":14,"topics":["shopify-api","http-status-code","ruby","shopify-app-development","shopify","shopify-graphql-api","graphql","rate-limiting"],"license":"MIT","category":"ecommerce","readme_excerpt":"Shopify API Retry Simple Ruby module to retry a ShopifyAPI request if rate-limited or other errors occur. Works with the REST and GraphQL APIs. If you don't need REST support use ShopifyAPI::GraphQL::Tiny instead. Installation Bundler: Gem: Usage REST API By default requests are retried when a Shopify rate limit error (HTTP 429) is returned. The retry happens once after waiting for the seconds given by the HTTP Retry-After header: You can override this: This will try the request 5 times, waiting 3 seconds between each attempt. If a retry fails after the given number of :tries the last error will be raised. You can also retry requests when other errors occur: This still retries rate limit requests, but also all HTTP 5XX errors. Classes can be specified too: You can also set global defaults. GraphQL API By default a retry attempt is made when your GraphQL request is rate-limited. In order to calculate the proper amount of time to wait before retrying you must set the X-GraphQL-Cost-Include-Fields header ( maybe this library should do this? ): Once this is set run your queries and mutations and rate-limited requests will be retried. The retry happens once, calculating the wait time from the API's cost data: To calculate the retry time the query's return value must be returned by the block . You can override the retry times: Like retry attempts made with the REST API you can specify errors to retry but, due to the GraphQL specification, these must not be HTTP status codes and are","default_branch":null,"files":null,"tree":[],"storefront":"/r/ScreenStaring","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ScreenStaring/shopify_api_retry/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}