App reviews, troubleshooting, and recommendations
Hi
I am trying to access and update my product through the REST Admin API reference.
First, i am doing the set up in the environment.rb file with
ShopifyAPI::Context.setup( api_key: API_KEY, api_secret_key: SECRET_API_KEY, host_name: STORE, scope: "write_script_tags,read_script_tags,write_channels,read_channels,read_analytics,write_product_feeds,read_products,read_product_feeds,write_product_listings,read_product_listings", is_embedded: true, # Set to true if you are building an embedded app is_private: true, # Set to true if you are building a private app api_version: "2023-10" # The version of the API you would like to use )
Then, i am starting my rails console.
Then I do:
test_session = ShopifyAPI::Auth::Session.new( shop: STORE, access_token: TOKEN, )
I can access some of my products with
ShopifyAPI::Product.all(session: test_session)
Now, I want to update published attribute of the product with the id X.
Following the documentation I do:
p = ShopifyAPI::Product.new(session: test_session)
p.id = X
p.published = false
p.save!
I have the error:
gems/ruby-3.1.3/gems/json-2.6.3/lib/json/common.rb:216:in `parse': unexpected token at 'Bad Request' (JSON::ParserError)
I don't understand what is going on...
Thanks for your help
Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023