Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

RecipientFilterWebservice

Query, create, or update target groups in Optimizely Campaign.

MethodDescription
addAndConditionAdds a target group condition using the AND operator.
addOrConditionAdds a target group condition using the OR operator.
beginConditionModificationBegins a transaction for modifications of a target group.
cancelConditionModificationEnds a transaction for modifications of a target group without updating the target group.
clearConditionsClears the conditions of a target group.
commitConditionModificationEnds a transaction for modifications of a target group and update the target group.
createCreates a persistent target group, that is valid after the end of the session.
createTemporaryCreates a temporary target group, that becomes invalid after the end of the session.
getColumnNamesQueries the column names of each target group.
getCountCounts all available target groups.
getDataSetQueries the data of each target group.
getDataSetFlatQueries the values of each target group.
getDescriptionQueries the internal description of a target group.
getIdsQueries the IDs of all available target groups.
getNameQueries the internal name of a target group.
isInUse)Queries whether a target group is used anywhere.
isTemporaryQueries whether a target group is temporary.
setDescriptionDefines the internal description of a target group.
setNameDefines the internal name of a target group.

Temporary target groups

Temporary target groups are only valid during the current session. These target groups can be used in ad hoc queries. You should use temporary target groups where possible since relying on persistent target groups may cause problems with concurrent modifications (by users of Optimizely Campaign). Using the RecipientFilterWebservice, you can create temporary target groups and check whether a target group is temporary.

Conditions

A target group consists of multiple conditions tied together by the AND or OR operator. Each condition consists of the following parameters:

  • Negate condition (y/n): A boolean that defines whether the condition will be wrapped in a NOT condition
  • Attribut e: The name of the recipient attribute the condition is based on
  • Operator: The name of the operation (like > or equals)
  • Attribute value: One or more parameters to the operation

These conditions are to be read in the logic: negate condition (y/n) [attribute name-operator-attribute value], e.g.:

[residence-is(equals)-Berlin]

Available operators

Read the notation of the available operations as follows:

operator(param1, param2)

whereas param1 and param2 are the attribute values you provide to the methods addAndCondition and addOrCondition.

The following operators are available:

  • contains(value): applicable only to attributes of the type String
    This filter is case insensitive.

  • startsWith(value): applicable only to attributes of the type String
    This filter is case insensitive.

  • endsWith(value): applicable only to attributes of the type String
    This filter is case insensitive.

  • isEmpty(): applicable to all attributes

  • isNotEmpty(): applicable to all attributes

  • ==(value): Aapplicable to all attributes

    This filter is case insensitive.

  • >=(value): applicable only to attributes of type Number, boolean and Date.

  • >(value): applicable only to attributes of type Number, boolean and Date.

  • <=(value): applicable only to attributes of type Number, boolean and Date.

  • <(value): applicable only to attributes of type Number, boolean and Date.

  • receivedMailing(mailingId): Checks whether a recipient has received the mailing with the given ID. Provide 0 as mailingId to test whether the recipient received any mailing. attributeName is not used.

  • openedMailing(mailingId): Checks whether a recipient has opened the mailing with the given ID. Provide 0 as mailingId to test whether the recipient opened any mailing. attributeName is not used.

Attribute values

If not otherwise stated, attribute values and attributes must be of the same type. All attribute values for an operation must be given as strings. See Type conversion and formatting rules for detailed information on how to convert values.

Example: Creates a target group that selects all Gmail recipients

####################
// SessionWebservice
$sessionWebservice = new SoapClient("http://api.campaign.episerver.net/soap11/RpcSession?wsdl");
 
// Login
$stringSessionId =
$sessionWebservice->login($longMandatorId, $stringUsername, $stringPassword);
 
// RecipientFilterWebservice
$recipientFilterWebservice = new SoapClient("http://api.campaign.episerver.net/soap11/RpcRecipientFilter?wsdl");
 
// Create a new filter with the initial condition
"email contains '@gmail.com'"
 
$longRecipientFilterId = $recipientFilterWebservice->create($stringSessionId, "Filter name", false, "Email", "contains", array("@gmail.com"));
 
// Add the or condition
$stringModificationId = $recipientFilterWebservice->beginConditionModification($stringSessionId, $longRecipientFilterId); $recipientFilterWebservice->addOrCondition($stringSessionId, $stringModificationId, false, "Email", "contains", array("@outlook.com")); $recipientFilterWebservice->commitConditionModification($stringSessionId, $stringModificationId);
 
// Logout
$sessionWebservice->logout($stringSessionId);
####################