Discussions

How to update/refresh a segment contact count using API?

jeremy.n
jeremy.n Posts: 7 Blue Ribbon

So we've been trying to automate the process of fetching contacts count in segments via API.

We're able to fetch the count of a segment without any problem using GET.

But the count never gets refreshed unless someone manually goes in the segment and either clicks on the Refresh icon, or Saves the segment to recalculate the count.

I've looked everywhere in the REST API but there's no endpoints allowing us to recalculate the Count of contacts in a segment. I've tried to update on the segment endpoint (using PUT), but all it does is just add the criteria/filters to a segment without recalculating it.

Has anyone done something not out of the box to recalculate/refresh the count in some way in segments via API?

Thanks so much!

Best Answer

Answers

  • jeremy.n
    jeremy.n Posts: 7 Blue Ribbon

    Hi Tom, thanks you're the best!

    I've just tried it (with POST) and it worked! The count was refreshed automatically once I did my GET right after.

    I will keep this in mind, for sure as it's no longer supported there will be risks of data discrepancies but this is better than having to manually refresh it all the time.

    Cheers and stay safe!

  • User_LJ9A2
    User_LJ9A2 Posts: 1 Green Ribbon

    I don't see the segment count updating after sending the POST to "/assets/contact/segment/queue/{yourSegmentId}".


    I get this response:

    {

    "type": "QueueInfo",

     "queuedAt": "{dateTime}",

     "segmentId": "{yourSegmentId}"

    }


    Then when I do the GET again the count is still old and has not been updated. Is there any other steps required?