We’re currently working on functionality that requires the segment_list & contact_list API methods–gather a list of available saved searches, then pull the contacts associated with a chosen segment/search. A couple of questions have come up now that we’re getting into the nitty gritty of using the results.
-
Is there a way to circumvent the pagination of the result sets? It would be really helpful to get all of the segment results back in one set.
-
If the answer to question 1 is no, is there a way to know beforehand how many results exist in either the segment_list or contact_list data set I’m retrieving? Is the only way to handle this type of data by continuing to increase the page number (?page=1) until I get an empty result set?
-
Filtering - I noticed in the segment_list results, there were a lot of random segments that were created by the system when automations are triggered. Is that what I’m seeing? What are those and what is their purpose?
-
Filtering - Is there a way to filter the segment_list results using a wildcard? What I’m looking for is a list of user-generated saved segments and I ended up with 11 pages of results, most of which have nothing to do with what I’m trying to retrieve from the system. It would be awesome to be able to just return those saved results, or at least to train our users to use a naming convention for their saved searches that we could then pass in to the filter parameter to get just the results that contain the wildcard. (eg. %My Segment%)
Thanks in advance for any advice you can provide.
Jim
1 Like
Hello Jim!
These are some great questions. I’ve tried to address each below:
- Unfortunately the pagination limit is 20 per page currently. This is to reduce query strain on accounts with larger segment data sets.
- There is no “total” included in the response, that I know of. Therefore you’ll have to keep paginating until you hit a page with < 20 results, which is the last page.
- Those are exactly as you alluded to - we use segments to power a lot of different sections/features of the platform, so any segments you didn’t create manually are in use by the system for other things (such as Advanced Contact Search).
- The current available filters are only two: name and automation ID. Both of these are exact matches, so you couldn’t conduct a wildcard search for the name (has to be an exact match).
We have a new API coming out (version 3) in the near-future that should address a lot of these shortcomings, so that is something to look out for. The documentation for that will likely end up here.
If you have further questions, just let us know!
Thanks for the quick response. Do you have any more insight currently on the release timeframe for API v3?
Hi,
I have the same question and if’ve tried that solution: go over the different pages until I find one of them with a number of results less than 20. That’s fine, but what about when the number of results retrieved is exactly 20? I have seen if retrieves the same values in all pages from that page in advance.
I guess the right result would be to retrieve 20 contacts in page 3, as an example, but then in the 4th page, to have 0, but it keeps on retrieving the same 20 contacts over and over again after the page 3.
Is that an issue? or how could we deal with this scenario?
I hope some one can assist about this.
Thanks.
Hi Javier,
The only thing you can do here is check the first contact in the results and if you have seen that contact on a previous page, you know it’s repeating the results. For example, each page you fetch you cache (on your end) the first contact returned. Then when fetching subsequent pages, check if that contact is in the results.
Hope that helps!
Hi! You can use pagination and set the page limit to 100 results and keep increasing the pages as in this example:
Please keep in mind that we are here to help, if you have any other questions on this topic or any other issue you can contact us anytime at Contact ActiveCampaign - Support and Sales
ActiveCampaign Customer Experience Team.