Config API Version 2 Segments
Introduction
A Segment is a concept that can be used to group triggers based on specific business logic (rather than Channels which is used to group triggers by marketing source).
- Each Segment is assigned a numeric ID that can be used to reference it in the APIs.
- Each Segment can also be assigned a Reference string, which can be used to refer to an Segment using a customer’s internal identifier.
- The Segment ID and Segment Reference are unique per IGRP, but are not globally unique.
- Triggers are associated to a particular Segment based on criteria that are defined for each Segment.
- All triggers are given a Segment ID of 1 by default if they do not match any criteria.
Segment Properties
These are the properties that can be accessed using the API.
- segment (int) - ID to use for Segment (Valid IDs are 2-65535, Segment 1 is Default)
- segmentName (string) - Friendly name of the segment (E.g. “My Segment”)
- segmentRef (string) - Your reference for this segment (E.g. “sectionAbcd”)
- segmentOrder (int) - The order in which this segment is detected (E.g. 1)
- orgId (int) OPTIONAL - Organisation ID the segment belongs to.
- criteria (array) - Array of criteria for given segment (each containing a field, op, and value).
- segmentStatus (int) - Infinity Status code indicating status of Segment (E.g. 200)
- segmentGroupId (int) - Identifies the group this segment belongs to, see Segment Groups
Segment Criteria Fields
Segment criteria fields may be any of those defined in the trigger reports (see Field Definitions), except for the following fields:
- attribution… - None of the attribution fields are suitable for criteria.
- segment - This is not yet defined when deciding the trigger’s segment.
- goal - Goals are calculated after segments, so are not available for segment criteria.
- goalTitle - Goals are calculated after segments, so are not available for segment criteria.
- goalValue - Goals are calculated after segments, so are not available for segment criteria.
- goalCurrency - Goals are calculated after segments, so are not available for segment criteria.
List Segments
Lists the Segments for an IGRP.
Request:
GET /config/v2/igrps/{IGRP SPECIFIER}/segments
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
GET Params
- filter (array) OPTIONAL - One or more filters, see Filter Types.
- sort (array) OPTIONAL - One or more sorting params, see Sort Types.
- limit (integer) OPTIONAL - limit on the result set.
- offset (integer) OPTIONAL - offset of the result set.
Filter Types
The Segments list may be filtered by any of the Segment Properties except for criteria.
Sort Types
The Segments list may be sorted by any of the Segment Properties except for criteria.
Response:
Returns a list of Segments that the user can access, including the Segment Properties described above.
Returns the HTTP response 200.
{"segment":"400","segmentRef":"Ref Segment","segmentName":"Test Segment 11","segmentOrder":"0","criteria":[{"field":"act","op":"begins","value":"12"},{"field":"href","op":"nbegins","value":"\/action\/do"}],"segmentStatus":"200","orgId":"2","segmentGroupId":"0"}
{"segment":"401","segmentRef":"Ref Segment 401","segmentName":"Test Segment 12","segmentOrder":"1","criteria":[{"field":"act","op":"begins","value":"12"},{"field":"href","op":"nbegins","value":"\/action\/do"}],"segmentStatus":"200","orgId":"2","segmentGroupId":"0"}
Read Segment Config
Returns the Segment Properties for a particular Segment.
Request:
GET /config/v2/igrps/{IGRP SPECIFIER}/segments/{SEGMENT SPECIFIER}
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
- SEGMENT SPECIFIER (int) - Segment ID.
Response:
Returns the HTTP response 200.
{"segment":"400","segmentRef":"Ref Segment","segmentName":"Test Segment 11","segmentOrder":"0","criteria":[{"field":"act","op":"begins","value":"12"},{"field":"href","op":"nbegins","value":"\/action\/do"}],"segmentStatus":"200","orgId":"2","segmentGroupId":"0"}
Create Segment
Creates a new Segment with properties.
Request:
POST /config/v2/igrps/{IGRP SPECIFIER}/segments
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
POST Params
- segment (int) OPTIONAL - Segment ID (2-65535, auto increment if not supplied)
- segmentName (string) - Segment Name (e.g. “Sales”) (Max 100 characters)
- segmentRef (string) OPTIONAL - Segment Reference (e.g. “1234”) (Max 100 characters)
- segmentOrder (int) OPTIONAL - Segment Order (e.g. 1, defaults to 0) (0-65535)
- orgId (int) OPTIONAL - Organisation ID the segment belongs to. If not specified, this will default to the IGRP’s primary Organisation.
- criteria (array) - The criteria to use when matching a segment. An array of objects, each with the following properties: field (the field to check), op (the operation to use when checking), and value (the value to check for).
- segmentGroupId (integer) OPTIONAL - Segment Group ID, defaults to zero, see Segment Groups.
Response:
HTTP 201 - CREATED
Update Segment Config
Update the properties for a particular Segment.
Note that built-in segments (IDs 0 and 1) may not be updated. If you want to change the Organisation they link to, you will need to update the IGRP resource instead.
Request:
POST /config/v2/igrps/{IGRP SPECIFIER}/segments/{SEGMENT SPECIFIER}
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
- SEGMENT SPECIFIER (int) - Segment ID.
POST Params
- segmentName (string) OPTIONAL - Segment Name (e.g. “Sales”) (Max 100 characters)
- segmentRef (string) OPTIONAL - Segment Reference (e.g. “1234”) (Max 100 characters)
- segmentOrder (int) OPTIONAL - Segment Order (e.g. 1) (0-65535)
- orgId (int) OPTIONAL - Organisation ID the segment belongs to. If not specified, this will default to the IGRP’s primary Organisation.
- criteria (array) - The criteria to use when matching a segment. An array of objects, each with the following properties: field (the field to check), op (the operation to use when checking), and value (the value to check for).
- segmentGroupId (integer) OPTIONAL - ID of the group that the segment belongs to, defaults to zero, see Segment Groups.
Response:
HTTP 204 - NO CONTENT
Order Segment Config
Sets the segment order.
Note that built-in segments (IDs 0 and 1) may not be ordered. They will always have a segmentOrder of 0. If you try to include these segments in the sortedSegments array the API will return an error.
Request:
PUT /config/v2/igrps/{IGRP SPECIFIER}/segments/order
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
PUT Params
- sortedSegments (array) - Array of Segment IDs, with the array index to be used as the order.
Response:
HTTP 204 - NO CONTENT
Delete Segment Config
Delete a particular Segment.
Request:
DELETE /config/v2/igrps/{IGRP SPECIFIER}/segments/{SEGMENT SPECIFIER}
URL Path Params
- IGRP SPECIFIER (int) - Installation ID.
- SEGMENT SPECIFIER (int) - Segment ID.
Response:
Returns the HTTP 204 (No Content) status code if delete successful.
HTTP 204 - NO CONTENT
Segment Groups
Introduction
A Segment Group is a concept that can be used to group segmented data for reports. Each segment may belong to only one Segment Group at a time.
Every trigger will be stamped with a segmentGroupId that will allow historical reporting of which triggers were in which Segment Group.
If a segment is moved from one group to another, this only affects new data. Historical triggers and metrics will still belong to the original segment group.
- Each Segment Group is assigned a numeric ID that can be used to reference it in the APIs.
- The Segment Group ID is unique per IGRP, but are not globally unique.
- All triggers are given a Segment Group ID of 0 by default.
Segment Group Properties
These are the properties that can be accessed using the API.
- segmentGroupId (int) - ID to identify the segment group
- segmentGroupName (string) - Name of the segment group
- igrp (int) - IGRP this segmentGroup belongs to
- segmentGroupStatus (int) - Status of the segment group (200: segment is active, 410: segment is deleted)
List Segment Groups
Lists the Segment Groups for an IGRP.
Request:
GET /config/v2/igrps/{IGRP SPECIFIER}/segmentGroups
Segment Group Params
- IGRP SPECIFIER (int) - Installation ID.
GET Params
- filter (array) OPTIONAL - One or more filters, see Filter Types.
- sort (array) OPTIONAL - One or more sorting params, see Sort Types.
- limit (integer) OPTIONAL - limit on the result set.
- offset (integer) OPTIONAL - offset of the result set.
Filter Types
The Segment Groups list may be filtered by any of the Segment Group Properties.
Sort Types
The Segment Groups list may be sorted by any of the Segment Group Properties.
Response:
Returns a list of Segment Groups that the user can access, including the Segment Group Properties described above.
Returns the HTTP response 200.
{"segmentGroupId":"400","segmentGroupName":"Segment Group Name 400","igrp":"1","segmentGroupStatus":"200"}
{"segmentGroupId":"401","segmentGroupName":"Segment Group Name 401","igrp":"1","segmentGroupStatus":"200"}
Read Segment Group Config
Returns the Segment Group Properties for a particular Segment Group.
Request:
GET /config/v2/igrps/{IGRP SPECIFIER}/segmentGroups/{SEGMENT GROUP SPECIFIER}
Segment Group Params
- IGRP SPECIFIER (int) - Installation ID.
- SEGMENT GROUP SPECIFIER (int) - Segment Group ID.
Response:
Returns the HTTP response 200.
{"segmentGroupId":"400","segmentGroupName":"Segment Group Name 400","igrp":"1","segmentGroupStatus":"200"}
Create Segment Group
Creates a new Segment Group with properties.
Request:
POST /config/v2/igrps/{IGRP SPECIFIER}/segmentGroups
Segment Group Params
- IGRP SPECIFIER (int) - Installation ID.
POST Params
- segmentGroupName (string) - Name of the segment group
Response:
HTTP 201 - CREATED
Update Segment Group Config
Update the properties for a particular Segment Group
Request:
POST /config/v2/igrps/{IGRP SPECIFIER}/segmentGroups/{SEGMENT GROUP SPECIFIER}
Segment Group Params
- IGRP SPECIFIER (int) - Installation ID.
- SEGMENT GROUP SPECIFIER (int) - Segment Group ID.
POST Params
- segmentGroupName (string) - Name of the segment group
Response:
HTTP 204 - NO CONTENT
Delete Segment Group
Delete a particular Segment Group. It is not possible to delete a Segment Group if it contains segments.
Request:
DELETE /config/v2/igrps/{IGRP SPECIFIER}/segmentGroups/{SEGMENT GROUP SPECIFIER}
Segment Group Params
- IGRP SPECIFIER (int) - Installation ID.
- SEGMENT GROUP SPECIFIER (int) - Segment Group ID.
Response:
Returns the HTTP 204 (No Content) status code if delete successful.
HTTP 204 - NO CONTENT