Weble / ZohoBooksApi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filters is not working

ProgrammerZ opened this issue · comments

commented

Everything is working, except the filters, they are ignored, including pages.

$res = $zohoBooks->invoices->getList(['status' => 'unpaid', 'page' => 3, 'per_page' => 200]);
$res = $zohoBooks->contacts->getList(['email' => 'name@domain.com']);
commented

Since I'm absolutely new to Zoho Books, not sure what was before in API, but it seems I have found the issue. The parameters for List need to go to query.

protected function getHttpClientOptions(array $data = [], array $rawData = []): array
{
    $json = ['JSONString' => json_encode($data)];
    $query = array_merge(['organization_id' => $this->getOrganizationId()], $rawData);
    return array_merge([
        'query'       => $query,
        'form_params' => $json,
        'headers'     => ['Authorization' => 'Zoho-oauthtoken ' . $this->oAuthClient->getAccessToken()]
    ]);
}

Hi @ProgrammerZ can you state which version of the SDK are you on?

Thanks!

Gonna test this tomorrow and let
You know 👌🏻

Hi @ProgrammerZ i've release 4.1.0 that fixes this issue, alongside a test that prevents this from happening again.

208b7d5

Please take note also of how the filters work in zoho books:
https://www.zoho.com/books/api/v3/#Contacts_List_Contacts

By default, it does an exact match ;)

commented

@Skullbock Thank you for your hard work, really appreciate that!

Feel free to pr any change you see fit to this library 👌🏻