shqear93 / zoho-inventory-api

Zoho Inventory Api
9 stars 10 forks source link

Filter in list items? #3

Closed torian257x closed 7 years ago

torian257x commented 7 years ago

your code:


  public function listItems(array $filters = [])
  {
    return $this->curlRequest("/items/", 'GET', $filters);
  }

see there is a filters parameter

does it actually work? because the API docs does not state filters:

https://www.zoho.com/inventory/api/v1/#list-all-item

if it does work, does this filter work for other calls too? is there an example?

shqear93 commented 7 years ago

yes, it's working according to their web application, it's not documented as you know! you may try to put some filters in the parameter, just pass your associative array of fields and values to filter! here is full example :

$zoho = new ZohoClient([
    'accessToken' => <zoho.accessToken>,
    'organizationId' => <zoho.organizationId>,
]);
$zoho->listItems([
    'search_text' => 'some text',
    'filter_by' => 'Status.Active',
    'page' => 1,
    'per_page' => 2,
    'sort_column' => 'sku',
    'sort_order' => 'D',
    'upc' => '722589819810'
]);

This code brings the first 2 items decendants sorted by their sku and contains the sentence "some text" and their upc is 722589819810