demonchand
demonchand

Reputation: 11451

Magento API version incompatibility

I am creating catalog products using Magento's core API. It works fine on Magento version 1.4.1.1, but the same code doesn't work on Magento ver 1.5.0.1.

Here's my code:

require 'rubygems'
require 'soap/wsdlDriver'

WSDL_URL = 'http://example.code/api/v2_soap/?wsdl=1'


soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver

session = soap.login('theuser','theuser123')

data = { "name" => "BARRACUDA", "description" => "fill", "short_description" => "fill", "weight" => "12", "status" => 1, "visibility" => 4, "price" => 350.00 , "tax_class_id" => "2", "qty" => 10, "stock_availability" => "0", "category_ids" => [3] }

a1 = soap.call('catalogProductCreate',session,"simple",1,"black: ONT-920-B",data)

Is there any problem with my code, or any new things added to Magento version 1.5.0.1?

Thanks

Upvotes: 1

Views: 664

Answers (1)

demonchand
demonchand

Reputation: 11451

The problem is missing one attribute in date field

data = { "name" => "BARRACUDA", "description" => "fill", "short_description" => "fill", "weight" => "12", "status" => 1, "visibility" => 4, "price" => 350.00 , "tax_class_id" => "2", "qty" => 10, "stock_availability" => "0", "category_ids" => [3],  "websites" => [1] }

Need to mention the websites id in the array of data in magento 1.5.

This is works for me!

Upvotes: 1

Related Questions