I recently found that calling https://api.xero.com/api.xro/2.0/contacts
returns results but does not populate the ContactPersons
field, and it's always empty.
However, calling the API with the ids
query parameter populated, then it does populate the ContactPersons
property correctly.
This does create an awkward situation, where on initial calls to the contacts, I need to loop though all the results then individually call the contacts again while passing the ids
query parameter for each just to be able to extract the ContactPersons
details.
Is there some other way of returning all the contacts
while also returning the ContactPersons
for those contacts?
I tried using the searchTerm
query param to force return the result, hoping that it would then populate. However this did not work.
I also tried using the searchTerm
to only return the ContactID
then having my loop to extract the details for each contact, however ContactID
does not seems to be a valid searchTerm
so this also did not work.
I'm currently making use of the summaryOnly
and setting it to true
. Then still looping though the results, and calling the API again but with the ids
query parameter to get the results I require.
PS: I am luckily also making use of the If-Modified-Since
in all of this. So would only really be a problem if it was the first time.
One thing I did not verify was that if changes to the ContactPersons
would trigger the If-Modified-Since
to include the contact again. Might need to test and verify when it happens.