Discussions

Creating a segment via API with elements-criteria

Hi there,

I am trying to create a contact segment via an API with a filter criteria that includes email address equalling a picklist of email addresses. I have successfully created it with the request body below (by doing a GET call on an existing segment and copying the response), however it has in the body elements.filter.criteria.id which has to match the elements.filter.statement (=274 in this case). If it doesn't, the segment isn't created correctly. Does anyone know what/where these fields are found? Also, where the optionListId is found?

{
"type": "ContactSegment",
"folderId": "701",
"name": "Test 1",
"elements": [
{
"type": "ContactFilterSegmentElement",
"isIncluded": "true",
"filter": {
"type": "ContactFilter",
"currentStatus": "Draft",
"name": "Contact Email Address",
"criteria": [
{
"type": "ContactFieldCriterion",
"id": "274",
"condition": {
"type": "TextSetCondition",
"operator": "in",
"optionListId": "36",
"quickListString": "[email protected]"
},
"fieldId": "100001"
}
],
"scope": "global",
"statement": "274"
}
}
]
}

Answers

  • OptionListId is the id of the asset. It is an OptionList which you can find via an application API. Here is an example. Note: when a user creates a quicklist, Eloqua creates an OptionList asset.

    The "scope" value refers to the filter element in your segment. Also the "statement" is simply referring to that assets id. There isn't a standard endpoint for Contact Filters but you can see them if you use this endpoint, with the asset Id e.g. api/REST/2.0/assets/contact/filter/100067