Please note: this set of APIs is scheduled for deprecation in 2017. New implementations should start by using the newly released Evaluation API. 


An IQL can be evaluated if the following preconditions are met

  1. The profile on which the IQL is to be evaluated must exist.


IQL 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 iql.


Request Headers

Header

Required

Acceptable Value(s)

Description

AcceptYesapplication/json
Content-encodingNogzipCaller can send a gzipped request to the API and set the Content-encoding as gzip.
Accept-encodingNogzip

Caller can request a gzipped response from the API and set the Accept-encoding as gzip.



Query parameter

Required

Description

app_keyNoAn 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_idYesReferences an existing profile.
iqlYesRefers to an IQL expression.
filteredProfileNofilteredProfile can have a value of "true" or "false". If filteredProfile is set to true and the result of the iql 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 iql evaluation.


Example: Response of a requested a IQL Evaluation


Response Body
{
 
   "segment-evaluation":{
      "result":<true|false>
   },
   "links":{
      "self":"http://&lt;hostname&gt;/v1/companies/&lt;companyId&gt;/buckets/&lt;bucketId>/segment-evaluation"
   }
 
}


Example: Response of requesting an IQL Evaluation with filteredProfile set to true and a successful evaluation


Response Body
{
 
   "segment-evaluation":{
      "result":true,
      "filteredProfile":{
         "id":"<profileId>",
         "sessions":[
           ...
         ],
         "attributes":[
           ...
         ]
      }
   },
   "links":{
      "self":"https://&lt;hostname&gt;/v1/companies/&lt;companyId&gt;/buckets/&lt;bucketId>/segment-evaluation"
   }
 
}