Create new Segment
Create new Customer/Visitor segment
POST
http
://api.ants.tech/access/api/segment/create
Request
Body
segmentDisplay
: Segment nameitemTypeId
: Type to define the Customer segment or Visitor segment (-1003
for Customer segment, -1007
for Visitor segment)conditions
:file_path
: Path of the file, taken from the Upload APIfile_name
: File name saved on the CDP system, taken from the Upload APIoriginal_file_name
: File name when the user uploads, taken from the Upload APIextension
: File extension, taken from Upload APIdelimiter
: Delimiter of the file, taken from the Upload APImethod
: Method to upload segment, value is:create
: When creating a new segment
criteria_logic
: Matching method to update audiences, one of the following typesor
: Just need to satisfy one of themapping_fields
conditions to update the audiencesand
: Allmapping_fields
conditions must be met to update audiences
mapping_fields
: Array of conditions to map the fileheader
with BOattributes
to update audiences, maximum 5 conditionsitem_attribute_code
: Attribute internal code of the BOheader_code
: Header of the uploaded file, taken from the Upload APIheader_index
: Index of the uploaded file, taken from Upload APIoperator
: Condition for matching betweenheader
file and BOattribute
, one of the following typesexactly
: Same between header and attribute, used for datatypeSTRING
equals
: Same between header and attribute, used for datatypeNUMBER
,DATETIME
,BOOLEAN
not_equals: Not same between header and attribute, used for datatype
NUMBER
,DATETIME
,BOOLEAN
computeSchedule
: Segment's computation scheduletype
: Segment calculation type, one of the following typesstatic
: Calculate once when creating a Segmentdynamic
: Calculate according to schedule, update audiences according to setup time
repeatType
[optional]: Calculation type of type"dynamic",
one of the followingnone
: Only counted once after creating Segmenthours
: Recalculate segments in hours (1-24)days
: Recalculate by days (1-365)weeks: Recalculate by week (1-52)
months
: Recalculate by month (1-12)
repeatValue
[optional]: Repeat value ofrepeatType
(egrepeatValue
=5
,repeatType
="hours"
, the segment will be recalculated every 5 hours)repeatOnValue
[optional]: Array containing a specific day or date to repeat (used whenrepeatType
="weeks"
|"months"
)repeatStartTime
[optional]: Segment calculation start timeday
: Calculation start date (formatYYYY-MM-DD
)hour
: Calculation start time (formatHH:mm
)
endTime
[optional]: End time of Segment calculationtype
: Type ofendTime
, one of the following typesnone
: Never endson_day
: Ends at a specific timeafter_num_running
: Ends after running enough times
onDay
[optional]: Value for type is"on_day"
day
: End date (formatYYYY-MM-DD
)hour
: End time (formatHH:mm
)
numRunning
[optional]: Value for type is"after_num_running"
shareAccess
: Share permissions for other accounts to act on this segmentdescription
: Description of shared access rightsis_public
: Whether the segment is public or not (0
|1
)public_role
: Action permission for Segment, one of the following types2
: Editor3
: Viewer
list_access
: List of users and action rights for the Segmentuser_id
: ID of the userallow_edit
:1
|0
allow_view
:1
|0
allow_comment
:1
|0
role
: The user's role for the Segment, one of the following types1
: Owner2
: Editor3
: Viewer4
: Commenter
alertSetting
: Setting notification when Segment calculation succeeds or failsalertAccountIds
: List of user IDs to receive notificationsalertScopes
: Scope notifies when the calculation is completesuccess
: Array containing"email"
|"app_push"
, notification when Segment calculation is successfulfailure
: Array containing"email"
|"app_push"
, notification when Segment calculation fails
{
"conditions": {
"file_path": "/S3/cdp-import-export/import/segment/33167",
"method": "replace",
"file_name": "-1003_1600083836_1707120681099.csv",
"extension": "csv",
"delimiter": "\t",
"mapping_fields": [
{
"item_attribute_code": "id",
"operator": "exactly",
"header_code": "id",
"header_index": 0
},
{
"item_attribute_code": "name",
"operator": "exactly",
"header_code": "message",
"header_index": 5
},
{
"item_attribute_code": "date_created",
"operator": "equals",
"header_code": "created_date",
"header_index": 1
},
{
"item_attribute_code": "phone",
"operator": "exactly",
"header_code": "from_user",
"header_index": 2
}
],
"original_file_name": "test_upload.csv",
"criteria_logic": "or"
},
"itemTypeId": -1003,
"computeSchedule": {
"type": "static",
"repeatType": "none"
},
"segmentDisplay": "[dat] test upload 5",
"shareAccess": {
"description": "",
"is_public": 0,
"public_role": null,
"list_access": [
{
"user_id": "1600080515",
"allow_edit": 1,
"allow_view": 1,
"allow_comment": 1,
"role": 1
}
]
},
"alertSetting": {
"alertAccountIds": [
1600080515
],
"alertScopes": {
"success": [],
"failure": [
"email",
"app_push"
]
}
}
}
Headers
Authorization*
Bearer <ACCESS_TOKEN>
Response
{
"code": 200,
"message": "Success",
"data": {
"meta": {
"total": 1
},
"entries": [
5546595
]
},
"duration": "0.915 ms"
}
Last updated