I need to transfer the old eshop to a new one made on Spree. It has a good API to do this.
But I am stuck in downloading images from a remote server. Here is what I do when creating a new product:
require 'nokogiri'
require 'open-uri'
require 'curb'
require 'uri'
http = Curl.post("http://DOMAIN/api/products?product[name]=Test\
&product[price]=123\
&product[shipping_category_id]=1\
&product[taxon_ids]=52\
&product[sku]=020323232\
&product[image]=http://www.computercloset.org/Altair_8800_and_Santa.jpg") do |http|
http.headers['X-Spree-Token'] = 'd60ff5896cef2920d83f18c11b95ee1dff8d9c82d1480cbc'
end
The product saves all parameters except the image.
I think I have the wrong syntax, but I cannot find an example or something about uploading images to http://guides.spreecommerce.com/api/
source
share