XeroAPI/Xero-Java

"accountingApi" single versus all contacts retrieval inconsistency

smith558 opened this issue · 2 comments

SDK:

  • Version 4.11.1

Describe the bug

accountingApi.getContacts returns contacts with salesTrackingCategories & purchasesTrackingCategories being [](empty List) for all contacts, even for those for which these fields have been filled via the Xero platform interface. However, accountingApi.getContact for given contacts returns these fields filled correctly and with correct values.

To reproduce

Contact contact = accountingApi.getContact(accessToken, XERO_TENANT_ID, UUID.fromString("UUID_as_a_string")).getContacts().get(0);
System.out.println(contact);

returns correctly for the fields in question:

salesTrackingCategories: [
class SalesTrackingCategory {
        trackingCategoryName: Region
        trackingOptionName: South
    },
class SalesTrackingCategory {
        trackingCategoryName: Custom
        trackingOptionName: One
    }]
purchasesTrackingCategories: [
class SalesTrackingCategory {
        trackingCategoryName: Region
        trackingOptionName: North
    },
class SalesTrackingCategory {
        trackingCategoryName: Custom
        trackingOptionName: Three
    }]

BUT

Contacts contacts = accountingApi.getContacts(accessToken, XERO_TENANT_ID, null, null, null, null, null, null, null);
System.out.println(contacts);

returns the same contact (after looking up the contact in the output with the same UUID) with the given fields being an empty list

salesTrackingCategories: []
purchasesTrackingCategories: []

HOWEVER

Using accountingApi.getContacts and providing the UUID parameter works as expected.

Contacts contacts = accountingApi.getContacts(accessToken, XERO_TENANT_ID, null, null, null, Collections.singletonList(UUID.fromString("UUID_as_a_string")), null, null, null);
System.out.println(contacts);

Hi @smith558 , thanks for pointing this out!

Given the params you provided, you are experiencing expected behavior from our API. There is definitely room for improvement with our documentation, but if you review our reference docs for GET Contacts we mention paging is required to receive full details in our response. In your request the page param is NULL. Please try paging contacts and let me know if it resolves this issue.

@rdemarco-xero Hi and thanks for getting back to me so fast! I was consulting mostly this documentation and it was not specified there. I have already implemented my own alternative getWholeContacts method which is precisely utilising the page parameter you mentioned, so I can confirm that works. Thanks for the clarification again! There might be some space for the docs improvement.