Best API versioning updgrade practices

Solved
Shopify Partner
23 3 0

I am updating my app from 2019-10 to 2020-01 but wondering how to do this appropriately?

 

I am using ROR with the shopify app and api gem.

 

I set the initializers/shopify_app.rb

 

config.api_version = "2020-01"

Although, when I go to test the API, I get this error in console:

 

ShopifyAPI::ApiVersion::UnknownVersion (2020-01 is not in the defined version set: unstable, 2019-04)

By using:

 

shop = Shop.find(1)
session = ShopifyAPI::Session.new(domain: shop.shopify_domain, token: shop.shopify_token, api_version: '2020-01') ShopifyAPI::Base.activate_session(session)

I also tried setting the base:

 

ShopifyAPI::Base.api_version = '2020-01'

Same error

 

Do I need to reinstall the app in the domain for the API update to take effect?

 

I was under the impression we can simply define the API version manually, regardless of the app.

 

0 Likes
Highlighted

Success.

Shopify Partner
23 3 0

the attribute `page_info` is basically the new `page`, except you are only able to get the previous and next page. 

 

To get a specific page, you will need to do some math and check against the total vs the limit to figure out what page you are on and loop the products that way.  Maybe there is another way but that's all I can figure out at this time.

0 Likes