-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contact Filter on AccountNumber doesn't filter contacts but returns all records. #47
Comments
I was able to replicate this issue filtering by email address returns all contact
I was able to find the cause: In the guzzle method your calling get this way ->$type(self::$baseUrl . $request, $data), which means data is empty and the query parameters for the "where" filter is concatenated with the baseUrl like here:
which does not work because upon inspection the query parameter does not get included in the request The query is supposed to be something like this to work
The workaround for this is something like this:
For inspecting the request object you can do something like this before calling Xero and Http
Notice that the query attribute of the request object when using Xero::get returns empty, but if you separate the query parameter for get just like suggested above, the request object shows query value. I can create a PR if you like, but it will take some time since I have my own integration that I need to finish. I guess this is not just happening on contact but on invoices as well if you try to use the where filter. By the way, Thanks a lot for the package helps me a lot to speed up integrations especially how you handle token renewal, it was helpful. |
thanks, @twocngdagz really helpful reply! Working on improving the filtering and managed to get this working without altering the public API Xero::contacts()->get(1, ['where' => 'ContactID==Guid("74ea95ea-6e1e-435d-9c30-0dff8ae1bd80")']); Still testing this out. |
addressed this using a new filter option #61 |
I'm using the following code Xero::contacts()->get(1, 'AccountNumber="10307"') and returns a collection of all contacts and not just the single contact where AccountNumber = 10307
When I use the more raw method of using the verbs, I get the intended result. See below.
$endpoint = 'Contacts';
$query = ['where' => 'AccountNumber="' . $accountNumber . '"',];
$result = Xero::get($endpoint, $query);
Is this a bug with Xero::contacts()->get(1, 'AccountNumber="10307"')? The format looks simple and aligns with the examples provided.
The text was updated successfully, but these errors were encountered: