1
$apiUrl = 'http://192.168.1.7/xxxx/api/rest';

...

$oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);

$resourceUrl = "$apiUrl/products?page=1&limit=5";

$oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json', 'Accept' => '*/*'));
$productsList = json_decode($oauthClient->getLastResponse());

print_r($productsList);
exit;

I have getting list of product using rest api but i wants a filter with status=1 and visibility=4

2 Answers 2

2

Try with this url:

$apiUrl/products?page=1&limit=5&filter[status]=1&filter[visibility]=4

[Edit]
I tried with this url and it worked:

$apiUrl/products?page=1&limit=5&filter[0][attribute]=status&filter[0][eq]=1&filter[1][attribute]=visibility&filter[1][eq]=4

But before trying make sure that you are allowed to view and filter by status and visibility.
You can set the allowed attributes from System->Web Services->Rest Attributes and select the role you are using (admin, customer or guest).

3
  • not work 400 .Resource collection filtering error. Commented Mar 18, 2015 at 9:36
  • Ok. I will try something different and let you know.
    – Marius
    Commented Mar 18, 2015 at 9:36
  • @ravipatel See my update.
    – Marius
    Commented Mar 18, 2015 at 9:56
-2

You can use Magento SOAP API which is described below URL:-

http://www.magentocommerce.com/api/soap/catalog/catalogProduct/catalog_product.list.html

which has parameter to pass filter options.

1
  • The OP is asking about the rest api not soap.
    – Marius
    Commented Mar 18, 2015 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.