Skip to content

delightech/shopify_graphql_connect_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

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

Procedure

$ 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.rb

Dump Shopify's Admin schema example

Dumps 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-01

Execute GraphQL example

Export below environment variables

  • API_KEY
  • PASSWORD
  • SHOP_NAME
  • API_VERSION
bundle exec ruby fetch_test.rb

About

Example codes for executing GraphQL for shopify_api without rails

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages