Unfortunately it isn't possible out of the box. You are right, filters are only used to filter attributes and there is no "limit" parameter
Arguments:
Type | Name | Description
string | sessionId | Session ID
array | filters | Array of filters by attributes (optional)
string | storeView | Store view ID or code (optional)
Source: http://www.magentocommerce.com/api/soap/catalog/catalogProduct/catalog_product.list.html
Looking at the source code of Mage_Catalog_Model_Product_Api
confirms it:
/**
* Retrieve list of products with basic info (id, sku, type, set, name)
*
* @param null|object|array $filters
* @param string|int $store
* @return array
*/
public function items($filters = null, $store = null)
{
$collection = Mage::getModel('catalog/product')->getCollection()
->addStoreFilter($this->_getStoreId($store))
->addAttributeToSelect('name');
/** @var $apiHelper Mage_Api_Helper_Data */
$apiHelper = Mage::helper('api');
$filters = $apiHelper->parseFilters($filters, $this->_filtersMap);
try {
foreach ($filters as $field => $value) {
$collection->addFieldToFilter($field, $value);
}
} catch (Mage_Core_Exception $e) {
$this->_fault('filters_invalid', $e->getMessage());
}
$result = array();
foreach ($collection as $product) {
$result[] = array(
'product_id' => $product->getId(),
'sku' => $product->getSku(),
'name' => $product->getName(),
'set' => $product->getAttributeSetId(),
'type' => $product->getTypeId(),
'category_ids' => $product->getCategoryIds(),
'website_ids' => $product->getWebsiteIds()
);
}
return $result;
}
The collection gets filtered by store and by attributes and that's it. No way to further manipulate it. What you'd need to do is write an own API model that extends this class and adds its own method itemsWithLimit()
with an additional parameter.
Update by request
if using the REST API with OAuth is an option, you actually can provide a limit:
Additional Information
You can define the limit of items returned in the response by passing
the limit parameter. By default, 10 items are returned and the maximum
number is 100 items. You can also define the page number by passing
the page parameter. Example:
http://magentohost/api/rest/products?page=2&limit=20
Authorization header will be required for Admin and Customer user
types. The following parameters must be provided in the Authorization
header for the call:
- oauth_consumer_key - the Consumer Key value provided after the registration of the application.
- oauth_nonce - a random value, uniquely generated by the application.
- oauth_signature_method - name of the signature method used to sign the request. Can have one of the following values: HMAC-SHA1,
RSA-SHA1, and PLAINTEXT.
- oauth_signature - a generated value (signature).
- oauth_timestamp - a positive integer, expressed in the number of seconds since January 1, 1970 00:00:00 GMT.
- oauth_token - the oauth_token value (Request Token).
- oauth_version - OAuth version.
Source: http://www.magentocommerce.com/api/rest/introduction.html#RESTAPIIntroduction-Products
You can set the base image, small image and thumbnail image like this
$proxy->call($sessionId, 'product_media.update', array(
'Sku',
$imageFilename,
array('position' => 2, 'types' => array('image', 'small_image', thumbnail) /* Lets do it main image for product */)
));
Best Answer
This seams like a bug or something that was overlooked.
Let me take it step by step.
First take a look at the definition of the
catalogCategoryInfo
operation from thewsdl.xml
file inside theMage_Catalog
moduleYou will see that the response has the type
catalogCategoryInfoResponse
.This one looks like this:
This means that it will return one object of type
catalogCategoryInfo
. This one is:As you can see there is not
image
orthumbnail
element among the ones returned.I don't know if this is a bug or a feature or someone simple overlooked it.
But here is what you can do. You can create your own module that will add the image attribute in the list of returned values from the method call.
Follow this example. It is for extending the product response, but it works the same for categories.
The idea is to take advantage of the fact that all the
wsdl.xml
files from all modules are merged into one big one. You can create your own, and following the same xpath as in the wsdl file for the catalog, add a new attribute to the response.