Magento API

SOAP

About Magento API

Module: Mage_Catalog

Resource: catalog_product

Aliases:

  • product
Method:
  • catalog_product.list (SOAP V1)
  • catalogProductList (SOAP V2)

Allows you to retrieve the list of products.

Aliases:

  • product.list

Arguments:

Type Name Description
string sessionId Session ID
array filters Array of filters by attributes (optional)
string storeView Store view ID or code (optional)

Returns:

Type Name Description
array storeView Array of catalogProductEntity

The catalogProductEntity content is as follows:

Type Name Description
string product_id
Product ID
string
sku
Product SKU
string
name
Product name
string
set
Product attribute set
string
type
Type of the product
ArrayOfString category_ids
Array of category IDs
ArrayOfString
website_ids Array of website IDs

Examples

Request Example SOAP V1
$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If somestuff requires api authentification,
// then get a session token
$session = $client->login('apiUser', 'apiKey');

$result = $client->call($session, 'catalog_product.list');
var_dump($result);

// If you don't need the session anymore
//$client->endSession($session);
Request Example SOAP V2 (List of All Products)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary

$result = $proxy->catalogProductList($sessionId);
var_dump($result);
Request Example SOAP V2 (Complex Filter)
$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

// If some stuff requires api authentification,
// then get a session token
$session = $client->login('apiUser', 'apiKey');
$complexFilter = array(
    'complex_filter' => array(
        array(
            'key' => 'type',
            'value' => array('key' => 'in', 'value' => 'simple,configurable')
        )
    )
);
$result = $client->catalogProductList($session, $complexFilter);

var_dump ($result);
Request Example SOAP V2 (WS-I Compliance Mode)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));

$result = $proxy->catalogProductList((object)array('sessionId' => $sessionId->result, 'filters' => null));
var_dump($result->result);
Response Example SOAP V1
array
  0 =>
    array
      'product_id' => string '1' (length=1)
      'sku' => string 'n2610' (length=5)
      'name' => string 'Nokia 2610 Phone' (length=16)
      'set' => string '4' (length=1)
      'type' => string 'simple' (length=6)
      'category_ids' =>
        array
          0 => string '4' (length=1)
  1 =>
    array
      'product_id' => string '2' (length=1)
      'sku' => string 'b8100' (length=5)
      'name' => string 'BlackBerry 8100 Pearl' (length=21)
      'set' => string '4' (length=1)
      'type' => string 'simple' (length=6)
      'category_ids' =>
        array
          0 => string '4' (length=1)