I have to migrate old eshop to new, made on Spree. It has good API to do it.
But i am stuck with uploading images from remote server. Here is what I am doing on making 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 is saving with all parameters, except the image.
I think I have wrong syntax, but I am unable to find example or something about uploading images on http://guides.spreecommerce.com/api/