Segment search through v3 API

SOLVED
Go to solution
RuhsarK
Campaign Contributor
0 Votes

Hi, Is there any way to search segments with the name with Constant Contact API V3.? Currently, in the documentation, i am seeing only search by id GET /segments/{segment_id}. However, I don't keep the ids in my system. How can I get details with name ? Thanks,

1 ACCEPTED SOLUTION
John__B
Employee
0 Votes

Hello RusharK,

 

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

When searching by an individual segment, the segment_id is required and there isn’t a way to search by segment name, however, you can retrieve a full list of segments from your account which includes the name and ID for each one by utilizing the GET all Segments request.

 

GET all Segments:

https://developer.constantcontact.com/api_reference/index.html#!/Segments/getAccountSegments

 

You can then take the segment_id for the specific segment you’re looking to retrieve details for and use it in the GET a Segment's Details request.

 

GET a Segment's Details:

https://developer.constantcontact.com/api_reference/index.html#!/Segments/getSegmentDetail

 

Please have a look and let us know if you have any other questions!

 

Regards,


John B.
API Support Specialist
Did I answer your question? If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.

View solution in original post

3 REPLIES 3
John__B
Employee
0 Votes

Hello RusharK,

 

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

When searching by an individual segment, the segment_id is required and there isn’t a way to search by segment name, however, you can retrieve a full list of segments from your account which includes the name and ID for each one by utilizing the GET all Segments request.

 

GET all Segments:

https://developer.constantcontact.com/api_reference/index.html#!/Segments/getAccountSegments

 

You can then take the segment_id for the specific segment you’re looking to retrieve details for and use it in the GET a Segment's Details request.

 

GET a Segment's Details:

https://developer.constantcontact.com/api_reference/index.html#!/Segments/getSegmentDetail

 

Please have a look and let us know if you have any other questions!

 

Regards,


John B.
API Support Specialist
Did I answer your question? If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.
RuhsarK
Campaign Contributor
0 Votes

Thanks for help. I am trying to create a segment, Please see request body below. 

{

    "name""Test Hope Count 2023",
    "segment_criteria""{\"version\":\"1.0.0\",\"criteria\":{\"type\":\"and\",\"group\":[{\"source\":\"list_membership\",\"field\":\"list_id\",\"op\":\"eq\",\"value\":\"f1d24760-0c4c-11ee-8112-fa163eaee913\"}]}}",
}
 
After I created, I am checking Constant Contact UI, and click on segment and I do not see the contacts from the list even though I refresh the segment multiple times ? How should I create segment_criteria based on contact list id or name ? 
 
Thanks
RuhsarK
Campaign Contributor
0 Votes
I am trying to create a segment, Please see request body below. { "name": "Test Hope Count 2023", "segment_criteria": "{\"version\":\"1.0.0\",\"criteria\":{\"type\":\"and\",\"group\":[{\"source\":\"list_membership\",\"field\":\"list_id\",\"op\":\"eq\",\"value\":\"f1d24760-0c4c-11ee-8112-fa163eaee913\"}]}}", } After I created, I am checking Constant Contact UI, and click on segment and I do not see the contacts from the list even though I refresh the segment multiple times ? How should I create segment_criteria based on contact list id or name ? Thanks
Resources
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up