How to change the password_enable from true to false using API

Shopify Partner
2 0 0

Hello, I am new to shopify API and would like to know if there is a way to change the password_enable from true to false. Below is a piece of my code and the screen output:

#Get data from the Shopify Store
shop = ShopifyAPI::Shop.current

shop_name=shop.name
puts shop_name

#Verify shop password status
shop_passwd_status=shop.password_enabled
puts shop_passwd_status

shop.password_enabled = false
shop.save

 

API output:

C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activeresource-5.0.0/lib/active_resource/connection.rb:164:in `handle_response': Failed.  Response code = 406.  Response message = Not Acceptable. (ActiveResource::ClientError)
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/shopify_api-5.1.0/lib/shopify_api/connection.rb:7:in `handle_response'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activeresource-5.0.0/lib/active_resource/connection.rb:133:in `request'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/shopify_api-5.1.0/lib/shopify_api/connection.rb:15:in `request'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activeresource-5.0.0/lib/active_resource/connection.rb:110:in `block in put'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activeresource-5.0.0/lib/active_resource/connection.rb:227:in `with_auth'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activeresource-5.0.0/lib/active_resource/connection.rb:110:in `put'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activeresource-5.0.0/lib/active_resource/base.rb:1491:in `block in update'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activeresource-5.0.0/lib/active_resource/base.rb:1490:in `update'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activeresource-5.0.0/lib/active_resource/base.rb:1285:in `block in save'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activeresource-5.0.0/lib/active_resource/base.rb:1284:in `save'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activeresource-5.0.0/lib/active_resource/validations.rb:117:in `save_with_validation'
        from private_store_connectivity.rb:36:in `<main>'

I would appreciate any help.

Thanks,

Ben

0 Likes
Shopify Expert
9778 86 1526

You can't change that property via the API.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Shopify Partner
2 0 0

Thanks Jason! Is there any other way the password can be enable/disable other than going to the admin page?

0 Likes
Tourist
6 1 0

Hi, we're curious about this too ... is there any other way to enable and disable the shop password if it can't be done from the API? (without having to login to the store)

0 Likes