REST_RESOURCES.md
This guide provides step-by-step instructions for adding a new API version to the Shopify API Ruby library. This example uses the addition of the 2025-07 API version as a reference, but the process applies to any new API version.
Edit lib/shopify_api/admin_versions.rb to add your new version and the next upcoming release candidate:
module ShopifyAPI
module AdminVersions
SUPPORTED_ADMIN_VERSIONS = T.let([
"unstable",
"2026-07", # Next release candidate (always add the next quarterly version)
"2026-04", # New version being added
"2026-01",
# ... other versions
], T::Array[String])
end
end
Version Management:
SUPPORTED_ADMIN_VERSIONS (below "unstable")mkdir lib/shopify_api/rest/resources/{YYYY_MM}/
Example: lib/shopify_api/rest/resources/2025_07/
mkdir test/rest/{YYYY_MM}/
Example: test/rest/2025_07/
Directory Naming Convention:
YYYY_MM (e.g., 2025_04, 2025_07, 2025_10)# Copy resource files
cp -r lib/shopify_api/rest/resources/{PREVIOUS_VERSION}/* lib/shopify_api/rest/resources/{NEW_VERSION}/
# Copy test files
cp -r test/rest/{PREVIOUS_VERSION}/* test/rest/{NEW_VERSION}/
Example:
cp -r lib/shopify_api/rest/resources/2025_04/* lib/shopify_api/rest/resources/2025_07/
cp -r test/rest/2025_04/* test/rest/2025_07/
After copying test files, you must update version-specific information in each test file.
Change the class name to include the new version:
# From
class AbandonedCheckout202504Test < Test::Unit::TestCase
# To
class AbandonedCheckout202507Test < Test::Unit::TestCase
Naming Pattern: {ResourceName}{YYYYMM}Test
202507 not 2025_07)In the setup method, update the API version:
def setup
super
test_session = ShopifyAPI::Auth::Session.new(id: "id", shop: "test-shop.myshopify.io", access_token: "this_is_a_test_token")
ShopifyAPI::Context.activate_session(test_session)
# Update this line:
modify_context(api_version: "2025-07") # Was "2025-04"
end
Update all API URLs in the test methods:
# From
stub_request(:get, "https://test-shop.myshopify.io/admin/api/2025-04/checkouts.json")
# To
stub_request(:get, "https://test-shop.myshopify.io/admin/api/2025-07/checkouts.json")
In this example, CustomerAddress was removed in 2025-07.
If a resource is removed:
# Remove resource file
rm lib/shopify_api/rest/resources/{NEW_VERSION}/{resource_name}.rb
# Remove test file
rm test/rest/{NEW_VERSION}/{resource_name}_test.rb
If a resource has structural changes:
@paths array if endpoints changed# Run all tests
bundle exec rake test
# Run specific version tests
bundle exec rake test TEST=test/rest/{NEW_VERSION}/*
SUPPORTED_ADMIN_VERSIONS in admin_versions.rbSUPPORTED_ADMIN_VERSIONSlib/shopify_api/rest/resources/{NEW_VERSION}/ directorytest/rest/{NEW_VERSION}/ directoryArticle202507Test)modify_context(api_version: "2025-07"))