Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Getting Started >

Contacts endpoint returns empty ContactGroups?

Started by Michael Wang -   in Getting Started


Is there any reason why Contacts endpoint returns empty array ContactGroups? While it's showing detail when I call trigger Get Contact by ContactID?

Also what's the most effective way to get all the contact details? I've tried the approach that get all the contact id via summaryOnly call, and loop through each contact via Get Contact by ContactID, however this would hit too many requests very soon as we've got over 2000+ contacts

You'll need to use the paging parameter i.e. GET Contacts?page=1 and increment until you'll receive an empty response.

You'll get 100 contacts with all details returned including the contact groups thus with 2000 contacts you'll need to do 20 calls.

Welli Abdullah (Xero Staff)  

Hi Welli,

Thanks for your reply, the main issue with Get Contacts is that it's returning empty ContactGroups (ContactGroups: ), it seems like Contacts will not return all the datagroups as the Get Contact by ContactID? (Highlevel vs detail call?)

Is that a known limitation?

Michael Wang  

Yes, it is by design.

When you retrieve multiple contacts, some of the fields such as contact groups and contact persons are omitted - this is to keep the response more compact.

As you've have found out, we recently introduced a new parameter summaryOnly to even reduce the response size.

Welli Abdullah (Xero Staff)