Magento Forum

   
Web Services API. Can someone please help? 
 
sidkathirv
Jr. Member
 
Total Posts:  1
Joined:  2008-09-22
 

My company has a stock control and order processing system that we are trying to link with Magento. I see that there are APIs to connect to Magento and upload products, edit and delete them. The problem is, We don’t know where to start. The SOAP ?wsdl works. But we have no clue where to even start! Say for example I want to just populate a product with some basic details… how do I go about it? I know you might be busy… but can you point me to some tutorial atleast.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Done
Jr. Member
 
Total Posts:  7
Joined:  2008-09-05
 

Hi,

I tried to update / insert products over the api too. I use the xmlrpc interface because as far as i know SOAP is prone to have interop problems (but the api is basically the same).
I’m also very new to magento but i can tell you what I know.
At first you can look at the the core api docs concerning Products and product attributes. Beside the login and endSession call the central function is the ‘call’ function.
Each ‘call’ needs at first the sessionKey (string) and the methodName (i.e. product.create). after this you have to append the needed parameters to your call described in the documentation.
Each product has assigned attributes - some of them are optional some of them are needed. Attribute combination are called attribute sets (In example data there are some predefined for example Default, Mobile Phone and so on). Moreover naturally a product is assigned to a category.
So if you want to create a new product over the core api you need to know the id of the category the product has to be added and the attribute set id.
The types your parameters must have you can see in the api documentation. If it is not clear what type the parameter should have - at the end of each page you can see an example in php.
If you want to call product.create the paramters can look like this:

parameter.add(value_string(sessionKey))
parameter.add(value_string("product.create")) // methodname
parameter.add(value_string("simple")) // producttype
parameter.add(value_int(setId)) // attribute set id
parameter.add(value_string(sku)) // sku
parameter.add(value_struct(attributes)) // attribute map

The ‘attributes’ is a struct (assoziativ container) with key => value pairs.

For the attributes which are needed and their names you can look in the management console Catalog->Attributes->Manage Attributes (Sets)

The coresponding setId’s you can retrive with a call to product_attribute_set.list

greetings,
Antonio

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top