Example codes for executing GraphQL for shopify_api without rails.
Original rake task's source(with rails): https://github.com/Shopify/shopify_api/blob/master/lib/shopify_api/graphql/task.rake
If you want to execute shopify's graphql without rails, pleae check Rakefile.
For using shopify's graphql, you have to dump the graphql schemas.
But, shopify_api's code require rails.
If you want to use it without rails, you have to require shopify_api gem and load shopify/graphql/task.rake as rake task.
After that, you can execute bundle exec rake shopify_api:graphql:dump
$ bundle
$ bundle exec rake shopify_api:graphql:dump SHOP_URL="https://${API_KEY}:${PASSWORD}@${SHOP_NAME}.myshopify.com" API_VERSION=2021-01
$ bundle exec ruby fetch_test.rbDumps a local JSON schema file of the Shopify Admin API. The schema is specific to an
API version and authentication is required (either OAuth or private app).
Dump the schema file for the 2021-01 API version using private app authentication:
$ bundle exec rake shopify_api:graphql:dump SHOP_URL="https://${API_KEY}:${PASSWORD}@${SHOP_NAME}.myshopify.com" API_VERSION=2021-01Export below environment variables
- API_KEY
- PASSWORD
- SHOP_NAME
- API_VERSION
bundle exec ruby fetch_test.rb