How can I filter the contacts created after a certain date and, if I have more than one page, scroll through them? | Community
Skip to main content
Answered

How can I filter the contacts created after a certain date and, if I have more than one page, scroll through them?

  • February 1, 2023
  • 4 replies
  • 136 views

According to the documentation I can only filter and get data from the first page or get all data without filter.

But, for example, I made a I posted the request at https://api.intercom.io/contacts/searchand it returned me that I have 8 pages with 50 contacts each, and that they were created with a certain date. But I can only access the data from page 1.

So I tried to use the post request to https://api.intercom.io/contacts?per_page=150to be able to reproduce the json that you demonstrate in https://developers.intercom.com/intercom-api-reference/reference/ -cursor paging. But instead of the 8 filtered pages it goes to 62 unfiltered pages.

Best answer by Oseas

Hey @user1631​! Oséas here from the Customer Support Specialist team 🕵️

 

You should be using POST requests for search resources. Could you please ensure you're applying the correct parameters described here? Just so you know, the starting_after refers to the next value provided in the response to queries with multiple pages, and this parameter is not required when it's not provided.

4 replies

Joseph S.
Expert User ✨
Forum|alt.badge.img+6
  • Expert User ✨
  • February 1, 2023

Hi @user1631​ 

 

Can you try if the following URL works for your case?

https://api.intercom.io/contacts?per_page=50amp;starting_after=<date>

This is a way to use the cursor-based pagination with the "per_page" and "starting_after" parameters in an effective way. Hope it works!

 

https://developers.intercom.com/intercom-api-reference/reference/pagination-sorting-search#pagination/p>


  • Author
  • New Participant
  • February 2, 2023

Hi @user1911​ ! Thanks for the reply!

To use this URL do I use post or get method? I tried both, but neither worked.


Oseas
Employee
Forum|alt.badge.img+4
  • Employee
  • Answer
  • February 3, 2023

Hey @user1631​! Oséas here from the Customer Support Specialist team 🕵️

 

You should be using POST requests for search resources. Could you please ensure you're applying the correct parameters described here? Just so you know, the starting_after refers to the next value provided in the response to queries with multiple pages, and this parameter is not required when it's not provided.


  • Author
  • New Participant
  • February 6, 2023

Thank U @user1911​ @oseas​ . Your tip helped a lot!