简体   繁体   English

休息Api以获得产品如何通过过滤器的“状态”和“可见性”

[英]Rest Api to get Products how to pass filter “status” and “visibility”

$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 我有使用Rest API的产品列表,但我想要一个状态为1可见性为4的过滤器

$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). 您可以从系统-> Web服务->其余属性中设置允许的属性, 然后选择您正在使用的角色(管理员,客户或来宾)。

More info for filter 过滤器的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM