XeroAPI/xero-php-oauth2

Get Contacts always returns null

anchordigi opened this issue · 1 comments

SDK you're using (please complete the following information):

  • Version 2.5.1

Describe the bug
I'm trying to get contacts via email address, but whatever I do returns no results. I've tried using the ID parameter too but still returned nothing.

Here's what i'm doing:

`
$apiInstance = $this->config();
$storage = new StorageClass();
$xeroTenantId = (string)$storage->getSession()['tenant_id'];

$ifModifiedSince = new DateTime("2019-02-06T12:17:43.202-08:00");
$where = 'EmailAddress="email@me.com"';
$order = "Name ASC";
$iDs = array();
$page = 1;
$includeArchived = true;

try {
  $result = $apiInstance->getContacts($xeroTenantId, $ifModifiedSince, $where, $order, $iDs, $page, $includeArchived);
} catch (Exception $e) {
  var_dump($e->getMessage());
   echo 'Exception when calling AccountingApi->getContacts: ', $e->getMessage(), PHP_EOL;
}`

I set up the AccountingApi in my config function, so that's not included in that cope snippet. That part is working though, I just can't figure out how to get the query working.

I'm using a Xero demo company and there is a contact with the email 'email@me.com'.

This was me being stupid and not realising the parameters were optional, got it working for email address now.