API Assets

New Member
3 0 0
I have been working with the shopify rails plugin / app for the last week and I have seemed to hit a wall with assets. Keeping things simple I am trying to simply find and display the _theme.liquid_ file. So here is my controller
  def index
    @asset = ShopifyAPI::Asset.find('layouts/theme.liquid')
  end
And my View
 

Asset#index

Asset key: <%=>

Asset value: <%=>

Here is the error message.
 ArgumentError in AssetsController#index

Missing site URI

RAILS_ROOT: /var/rails/author_setup
Application Trace | Framework Trace | Full Trace

/usr/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/connection.rb:85:in `initialize'
/usr/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/base.rb:323:in `new'
/usr/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/base.rb:323:in `connection'
/usr/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/base.rb:329:in `connection'
/usr/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/base.rb:587:in `find_one'
/usr/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/base.rb:522:in `find'
/var/rails/author_setup/vendor/plugins/shopify_app/lib/shopify_api.rb:355:in `find'
/var/rails/author_setup/vendor/plugins/shopify_app/lib/shopify_api.rb:357:in `find'
/var/rails/author_setup/app/controllers/assets_controller.rb:32:in `index'

The error makes me think that I am missing something in the find call, however I haven't been able to get it to work so far with all my testing. Any advice? -Bob Perkinson
0 Likes
Shopify Staff
Shopify Staff
195 0 3

Hi Bob,

“Missing site URI” sounds like there’s a problem with ActiveResource not being able to set the URL that the API requests go to (as in http://some-shop.myshopify.com/admin).

Can you check to see if any other API request works and that you’ve authenticated correctly?

Edward Ocampo-Gooding – Shopify Developer Advocate
0 Likes
New Member
3 0 0

It seems as though I missed putting in the around_filter authentication into the Assets controller. After adding that everything seems to be fine for creating and viewing assets.

Is there any way to access the “uploaded files” section using the shopify plugin?

0 Likes
Shopify Staff
Shopify Staff
195 0 3

Good to hear about the around_filter catch!

Unfortunately, uploaded files are not accessible via the API.

Edward Ocampo-Gooding – Shopify Developer Advocate
0 Likes