Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4619

How to create a product image on Magento Api using Ruby

$
0
0

I am try to upload a image on magento API using Ruby.

This is my code:

require 'rubygems'require 'soap/wsdlDriver'require 'base64'WSDL_URL = 'http://teeshop.chandru/api/v2_soap/?wsdl=1'soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driversession = soap.login('*********','*********')a = File.read('image/CP0760-01.jpg')enc = Base64.encode64(a)create_image = { 'file' => {"name" => "CP0760-01.jpg", "content" => enc,"mime" => 'image/jpeg'}, "label" => "kids cloths","position" => 0, "types" => ["image,""small_image", "thumbnail" ], "exclude" => 0 }product_image = soap.call('catalogProductAttributeMediaCreate',session,'CP0760 (P.34)',creeate_image,1,'sku')

When I run this code I got this error:

The image contents is not valid base64 data. (SOAP::FaultError)

Is there any solution for my problem?

Thanks


Viewing all articles
Browse latest Browse all 4619

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>