We're constantly trying to improve your support experience, and your feedback is extremely valuable to us.
Please take a moment to tell us about your experience today.
Sign up for future Help Center user research studies.
Using the Shopify API Console for Ruby
This page was printed on Sep 20, 2019. For the current version, visit https://help.shopify.com/en/api/guides/using-the-api-console.
If you’ll be writing your app in Rails, or want to troubleshoot issues in your app, the Shopify API Console for Ruby — a thin wrapper around our Shopify API Ruby gem — will allow you to easily interact with the Admin API directly from your terminal, without running a full Rails app or making HTTP requests via curl.
This tutorial will get you started using the Shopify API console in development.
Before you begin using the console, you will need a few things:
You’re presented with options for setting up and managing connection configuration. Nothing is set up yet, so start by adding a connection. Name it whatever you like, but make sure that the URL matches up with that of your development store. You’ll be prompted to enter in your API key and password. Be sure to enter the API password, not secret.
Now, start the console. Type shopify-api console:
To make things easier, you can include the ShopifyAPI module provided by the Shopify API gem right away. This is optional, but if you leave it off, you’ll need to prefix API calls with ShopifyAPI::.
Now you can start to query the API and look at data from your store. Check out the API docs to see what is queryable and mutable.
To get a list of products, type Product.all:
Try mutating some data; add a customer with the following values:
Don’t forget to save the entry!
You’ve now successfully added a customer to your dev store, and sent them an email invitation.
By making a small change to the previous example, you can see how to troubleshoot errors. Change the entry slightly to set a password instead of sending an email invite, and then save the entry.
Trying to save this data fails:
Type i.errors to find out why. You’ll get some information back on what you tried to POST, and some information on the error:
It didn’t work because the password is too short, and the email address is already registered to the first customer you created. You’ve just quickly and easily debugged why an API call wasn’t working!
Make complex calls
Get a list of resources using query parameters
Find all of a given resource type (e.g. Products, Customers, etc.), using the limit parameter to limit the results: