1
votes

I am working on a shopify app in which I want to run a script which is in Ruby. I want to update the 'position' and 'sort_value' of Collect object as per this link https://docs.shopify.com/api/collect. Everytime I try to do so I got an ActiveResource Error.

Here is my code in irb:

require 'shopify'
require 'active_resource'

shop_url = "https://#{API_KEY}:{PASSWORD}@SHOP_NAME.myshopify.com/admin"
ShopifyAPI::Base.site = shop_url
product = ShopifyAPI::Collect.find(:id)
product.position = 4
product.save

I have tried the code given below, which works fine in irb

product = ShopifyAPI::Product.find(179761209)
product.handle = "burton-snowboard"
product.save

I got this error:

ActiveResource::ResourceNotFound: Failed. Response code = 404. Response message = Not Found

Can we send http PUT request on Collect object to update position? Thanks in Advance..

1

1 Answers

0
votes

It appears you are not providing any ID to your call.

product = ShopifyAPI::Collect.find(:id)

What is that supposed to return?

I think you have a 404 returned it is a good indication you are not asking for something with a valid ID. Your second call works fine with an ID.