XeroAPI / xero-php-oauth2

Xero PHP SDK for oAuth 2 generated from Xero API OpenAPI Spec 3.0
MIT License
91 stars 65 forks source link

Get Contacts always returns null #219

Closed anchordigi closed 3 years ago

anchordigi commented 3 years ago

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

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'.

anchordigi commented 3 years ago

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