Hello RyanE6,
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.
Segments that are built via the API must follow the same criteria as segments that are built within the website UI, so for Custom Contact fields you can only use "is", "is not", "contains", "starts with", or "is blank", and there are no options available for sorting them by date.
I have tracked the open feature request "Segments - Option to Segment Custom Field by Date" with your account. This request is currently under review for future consideration by our engineering team. Your feedback and experience with this request is essential to improving our product, so thank you for reaching out to us regarding this matter.
The only contact values that you can use to create a segment by date are "Date Added", which is the date that the contact was created, and "Last Date Edited" which should be the date that the contact details were last edited.
Using the API, there are a few different ways that you could accomplish what you are looking to do, but it would require some additional programming within your application in order to update the date specifications in the way that you are wanting.
Here is one example of a flow that would accomplish this via the API:
[Step 1]
Get the "custom_field_id" for the field you want to work with:
GET custom_fields Collection
https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts_Custom_Fields/getCustomFields
[Step 2]
Get the "list_id" for the list where those contacts are stored:
GET Lists Collection
https://v3.developer.constantcontact.com/api_reference/index.html#!/Contact_Lists/getLists
[Step 3]
Make a call to GET /contacts and specify the List ID under the "lists" parameter, and for the "include" parameter, set the value to "custom_fields", like so:
Example:
api.cc.email/v3/contacts?lists=04fe9a97-a579-43c5-bb1a-58ed29bf0a6a&include=custom_fields
GET Contacts Collection
https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts/getContacts
From the response body data, for each contact where the "custom_field_id" matches the value of the "custom_field_id" we retrieved in Step 1, you'll want to save save the following fields for each contact in an array: "contact_id" & "value" (for that specific custom field, as there may be more than one)
[Step 4]
You'll then want your program to to parse the array data to return only contact data with a "value" within the desired date range, then you can add those contacts to a list, or add a tag to them for use in a segment.
Please have a look and let us know if you have any other questions!
... View more