Create a new segment
Request schema
Path parameters
ID of the source
Header parameters
HTTP: basicAuth
HTTP AuthorizationScheme: basic
Request
The name of this segment.
A list of Atomic Molecules, Related Segment Molecules, Relationship Molecules, Molecule Groups and at most one Operation Molecule.
A condition on an property of an entity. The property or column will belong to the entity described in the parent relationship molecule. If the basic molecule is top level, the condition is on the entity on which the segment is based on.
Represents the property name when attribute_type is property and the column name when attribute_type is column.
The type of the attribute for this condition. Options are:
- property for entity properties
- sql for sql conditions
- column for legacy segments
The operator for this molecule. Only certain operators will be valid for a given property type. For example, the greaterthan operator can only be applied to numeric values.
If the attribute_type is sql, then this is a SQL string. Otherwise the value being filtered on.
- a number for numerical operators
- a string for string operators
- a boolean for boolean operators
- an array for array operators
- for datetime operators, this could either be a datetime value, a number (for “morethandays” type operators), or a “between” value which is represented as a hash with the following structure { bound_one: X, bound_two: Y }. X and Y are either datetime values, blank (in which case they become the current datetime on the backend), or a string with the following structure "days_ago: Z" where Z is a number (can be decimal).
A condition based on including or excluding a related segment based off of the same entity.
The id of the related Segment
Condition to include or exclude members of the related filter segment
A condition or set of conditions on a related entity.
ID for the relationship object that connects both entities
Used only for creating conditions on event entities.
The type of constraint, will always be occurrences.
The operator to apply to the event constraint
The value to apply to the operator
Whether the constraint should be negated
A list of Atomic Molecules, Related Segment Molecules, Relationship Molecules, Molecule Groups and at most one Operation Molecule.
The id of the dataset on which this segment is based.
POST /api/v1/sources/{source_id}/filter_segments HTTP/1.1 Authorization: Bearer REPLACE_BEARER_TOKEN Content-Type: application/json Host: app.getcensus.com Content-Length: 208 { "name": "priority accounts", "molecules": [ { "attribute": "last_seen_at", "attribute_type": "property", "operator": "isnotnull", "value": "id" } ], "dataset_id": 0 }
Responses
201
Outcome of the operation.
The id of the newly created segment.
Some subproperties of the filter_segment are created asynchronously. You can query this url to fetch the status of the creation (true or false). When status is true, it will return all properties returned in GET /sources/{source_id}/filter_segments/{segment_id}.
{ "status": "created", "data": { "id": 9 }, "filter_segment_source_url": "https://app.getcensus.com/api/v1/sources/12/filter_segments/9/source_status" }