Please note: this set of APIs is scheduled for deprecation in 2017. New implementations should start by using the newly released Evaluation API.
A segment can be evaluated if the following preconditions are met
- A segment is created using the segments resource.
- The segment is enabled.
- The profile on which the segment is to be evaluated exists.
Segment evaluation can be done by making a request to url /v1/companies/<companyId>/buckets/<bucketId>/segment-evaluation. The request should be GET and a successful segment evaluation will result in a 200 OK. The segment-evaluation resource must be called with query parameters profile_id and segment_id.
Required permission segment.evaluation
Request Headers
Header | Required | Acceptable Value(s) | Description |
---|---|---|---|
Accept | Yes | application/json | |
Content-encoding | No | gzip | Caller can send a gzipped request to the API and set the Content-encoding as gzip. |
Accept-encoding | No | gzip | Caller can request a gzipped response from the API and set the Accept-encoding as gzip. |
Query parameter | Required | Description |
---|---|---|
app_key | No | An app key refers to a collectApp. If an app key is specified, the profile data is added as the collectApp corresponding to that app key. If no app key is specified then profile data is added using the default collectApp "web". Similarly, the response will return the collectApp data corresponding to the app key. The returned data will additionally be filtered though any whitelists and/or blacklists configured for this collect app. If no collect app is specified, data and; blacklist and whitelist configurations of collectApp "web" will be used. |
profile_id | Yes | References an existing profile. |
segment_id | Yes | References an existing segment. The segments are created using the Config API's segments resource. |
filteredProfile | No | filteredProfile can have a value of "true" or "false". If filteredProfile is set to true and the result of the segment evaluation is true, then the response json will contain an additional field called filteredProfile. The filtered profile contains the parts of the profile which matched the segment evaluation. |
Example: Response of requesting a Segment Evaluation
{ "segment-evaluation":{ "result":<true|false> }, "links":{ "self":"http://<hostname>/v1/companies/<companyId>/buckets/<bucketId>/segment-evaluation" } } |
Example: Response of requesting a Segment Evaluation with filteredProfile set to true and a successful evaluation
{ "segment-evaluation":{ "result":true, "filteredProfile":{ "id":"<profileId>", "sessions":[ ... ], "attributes":[ ... ] } }, "links":{ "self":"https://<hostname>/v1/companies/<companyId>/buckets/<bucketId>/segment-evaluation" } } |