Static Segments


Static segments maintain a constant list of the customers that are not recalculated.

The response is always set to default jobId, i.e., equal to 00000000-0000-0000-0000-000000000000 due to the following reasons:

  • The recalculation process does not exist.
  • There is a requirement to extend the already existing endpoints for static segments.

Creating Segments

Static segment can be created using POST endpoint with or without customers but cannot contain conditions. A static type segment is defined with Id equal to 2.

Modifying Segments

Customers can be added or removed at any time using the available PUT endpoint. The request contains the additional parameter originSegmentId, which can be used interchangeably with the customerIds parameter. Remember that you can pass only one of the parameters.

In the case of a PUT operation, the originSegmentId value should be equal to the segmentId value, which means that the list of the customers will not be changed. The list of customerIds is always treated as a complete list of customers assigned to the segment. An empty list will remove all the customers from the segment.

For segmentId = 2

OR

Changing the Segment Type

Use the PUT endpoint to change segment type from dynamic to static and vice versa.

  • Change Dynamic Segment to Static Segment: Changing to a static segment loses conditions and generated SQL, and the update frequency is set to None. All assigned customers should be passed as a list of customerIds or if the customers are not modified, then the originSegmentId property can be used.
  • Change Static Segment to Dynamic Segment: It is required to create conditions from scratch, and list of customers is not allowed as well as originSegmentId property. All old customers will be removed by the recalculation task executed for the new condition.

Cloning Segments

Segments can be also created by cloning existing objects using a dedicated POST endpoint. Depending on segment type, different parameters are required. Similar to static segment, a list of customers can be passed as originSegmentId from which customers are copied or as a full list of customerIds. In the result body, a new segment ID is returned.

Assigning Customer to Segments

Using new PUT endpoint, specific customer can be assigned to many static segments.