Rest api - pull up a list of contacts using an array of contact Ids

Using the
/tags/{tagId}/contacts endpoint,

I’m able to obtain a list of upto 1,000 contacts in a single api call.
(the documentation doesn’t specify the 1,000 limit, but if you provide a number bigger than 1,000 it’s treated as 1,000)
I could optionally then send in some more api calls to get a full list of contacts that have a particular tag.

Once I have the list I want, this api endpoint only gives me very basic information about these contacts.
It gives me their contact Id, their first name, last name, and email.

What I need though is also a list of their tags on these contacts so I can filter further and I also need access to a custom field on this list of contacts.

This almost does what I want:
It can grab their tag_ids and custom fields for a contact.
But it can only pull up one contact at once.

This would require thousands of api calls through the rest api merely to get the information I need on the resulting contacts that have a particular tag.

In the XMLRPC I can pull up 1,000 contacts at once from a very specific list of contact Ids through the table schema, and get back a list of tags and custom fields.

This functionality doesn’t exist in the REST api as far as I can see from the documentation.

Another option would be a saved search to get the data I need for a particular tag.
But saved searches are pretty heavy on resources, and time out for us periodically.
(Note we have a lot of contacts, over 300,000+)
(We’ve been advised in the past to just pull things one at a time from the table schema to workaround queries taking too long. We’ve had great success in doing this in parts through the table schema, and avoiding saved searches. )

We don’t use the REST api much but we do use the XMLRPC mostly for everything.

More recently we understand the XMLRPC has been marked deprecated.
We’ve been trying to move over to the REST api.
But there’s a lot of things it doesn’t seem to do.
For example the XMLRPC can do saved searches, while the rest api doesn’t seem to have this capability from what I can see in the rest api documentation.

It’s possible there’s undocumented or poorly documented rest functionality which I’m unaware of.
I have extensive experience with the XMLRPC, but still have learning to do regarding the REST api.

Currently I have to use the XMLRPC to achieve my end goal of pulling up the information I need on 1,000 contacts at once.

Is there a way to achieve this sort of functionality using only the REST api, without exhausting thousands of api calls?

If you dsQuery (xmlrpc sdk) the ContactGroupAssign table and use the contactID field you can get all the tags on a contact. But neither method (SDK or REST) have a method for getting a list of tags on a list of contacts at once. If you really need that then you’d be best hooking the tag.applied webhook, updating your own back end db and then using that.


But neither method (SDK or REST) have a method for getting a list of tags on a list of contacts at once

Thanks for the reply.

The “Contact” table has a Groups field. This would be a comma separated list of tag Ids that contact has for each matching record. When querying the table schema (e.g. dsQuery, data()->query, DataService.query) for the query you can put an array of contact Ids:
$query = [‘Ids’=>[1,3,5]];
Then for the resulting columns, you’d put:
This can be done in a single api call to get a list of tags for a list of contacts through the XMLRPC.

The webhooking idea might be worth considering for my particular use case to try to speed up a particular query I am working on… But I’ll just use the XMLRPC for now…

Would be nice to get this onto the REST api.