Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Wrapper libraries >

Contacts empty in ContactGroups (Xero-node)

Started by Craig Smith -   in Wrapper libraries

I am trying to retrieve the contacts within a contact group.
To do so I have the following code:

This code is provided by the developer community - Xero does not warrant it in any way

When i run this i receive multiple lines which states:
"Number of contacts 0"

It returns the correct number of contactgroups but each contact within a contact group is an empty array.

How do I retrieve the contact within a contact group???

Hi Craig,

If you make a request to the Contact Groups endpoint without specifying a contact group ID you will only get a list of all contact groups, with no actual contact data.
You need to make a request for each group to get the actual contacts back.

You can see the results from the two different types of calls here: https://developer.xero.com/documentation/api/contactgroups

and you can test it out with the previewer here:


Steven Brown (Xero Staff)