audienceSizes
post
/ccadmin/v1/audienceSizes
Audience Sizes. Given an ordered list of Audience Rules, retrieve an ordered list of registered shopper counts as if those rules were executed in combination with all previous rules in the order given (i.e. rule 1 count, rule 1 & 2 count, etc...). Note that the ruleSet operator will determine whether the counts increase or decrease: "any" will make the counts increase as more rules are considered and "all" will make the counts decrease. The endpoint also returns the total estimated number of registered shoppers in the system.
Request
Supported Media Types
- application/json
Root Schema : audienceSizes_request
Type:
Show Source
object
-
id(optional):
string
The Audience ID. This can be an empty string, but only if the Audience doesn't have an ID yet.
-
ruleSet:
object ruleSet
The rule set for the Audience.
-
visitorType(optional):
string
The visitorType of the audience. visitorType must be one of the following: "ANONYMOUS" (users not authenticated or soft logged in), "RECOGNIZED" (users that logged in before but, have not been authenticated in the current session), "AUTHENTICATED" (logged in users), "ANONYMOUS_OR_RECOGNIZED", "ANONYMOUS_OR_AUTHENTICATED", "REGISTERED", or "ALL". These correspond to various combinations of the options that appear in the UI (ANONYMOUS, RECOGNIZED, and AUTHENTICATED) where "REGISTERED" means the user selected RECOGNIZED and AUTHENTICATED and "ALL" means the user selected all three options.
Example:
{
"visitorType":"REGISTERED",
"ruleSet":{
"rules":[
{
"property":"gender",
"category":"profile",
"value":"male",
"operator":"eq"
},
{
"property":"registrationDate",
"category":"profile",
"value":{
"unit":"months",
"start":"now",
"interval":-3
},
"operator":"lt"
},
{
"property":"age",
"category":"profile",
"value":[
18,
25
],
"operator":"isBetween"
}
],
"operator":"all"
},
"id":"youngMenWhoRegisteredRecently"
}
Nested Schema : ruleSet
Type:
object
The rule set for the Audience.
Show Source
-
operator:
string
The operator applied to all of the rules in the rule set.
-
rules:
array rules
The array of rules that make up the rule set.
Nested Schema : items
Type:
Show Source
object
-
category:
string
The category of the property, i.e. profile, internalAudience, etc.
-
operator:
string
The operator applied to the rule property.
-
property:
string
The property to be evaluated.
-
value:
string
The value used to compare against the property value to determine the rule result. When mapping this field in Integration Cloud Service(ICS), the operators which expect string values alone can be used.
Response
Supported Media Types
- application/json
200 Response
Following model is returned when operation succeeds.
Root Schema : audienceSizes_response
Type:
Show Source
object
-
audienceSize(optional):
integer
An estimate of the overall size of this audience. If this is null it means that the size could not be accurately estimated.
-
registeredShoppers(optional):
integer
An estimate of the number of registered shoppers in the system.
-
ruleShopperCounts(optional):
array ruleShopperCounts
An ordered list of registered shopper counts as if given rules were executed in combination with all previous rules in the order given (i.e. rule 1 count, rule 1 & 2 count, etc...). Note that the ruleSet operator will determine whether the counts increase or decrease: "any" will make the counts increase as more rules are considered and "all" will make the counts decrease.
-
siteId(optional):
string
The ID of the site used to calculate this estimate.
-
siteName(optional):
string
The name of the site used to calculate this estimate.
Nested Schema : ruleShopperCounts
Type:
array
An ordered list of registered shopper counts as if given rules were executed in combination with all previous rules in the order given (i.e. rule 1 count, rule 1 & 2 count, etc...). Note that the ruleSet operator will determine whether the counts increase or decrease: "any" will make the counts increase as more rules are considered and "all" will make the counts decrease.
Show Source
Nested Schema : items
Type:
Show Source
object
-
devMessage(optional):
string
An optional developer message about this rule.
-
errorCode(optional):
string
The error code for this rule, if it was ignored. If this is present, then the message is an error message. If this is not present, then the message is an informational message.
-
isIgnored(optional):
boolean
Whether or not this rule was ignored.
-
message(optional):
string
An optional message about this rule. Must be present if the rule was ignored. If there is an error code, then this message is an error message. Otherwise it is just an informational message.
-
rules(optional):
string
A human readable string indicating the ordered list of rules executed. For example, "1" indicates that this would be the count if the first rule was executed, "1,2" indicates that this would be the count if the first two rules were executed, etc.
-
shoppers(optional):
integer
The estimated number of shoppers the Audience would contain after executing the rules specified in the "rules" string.
Example Response (application/json)
{
"registeredShoppers":1234,
"ruleShopperCounts":[
{
"rules":"1",
"shoppers":100
},
{
"rules":"1,2",
"shoppers":75
},
{
"rules":"1,2,3",
"shoppers":40
}
]
}
Default Response
The error response.
The following are the internal error codes thrown by this API when the request processing fails in Oracle Commerce Cloud:
|Error Code|Description|
|------------------|------------------|
|54004|An error occurred accessing audiences.|
|54004|There was an error determining audience sizes.|
|54004|An error occurred while querying for the shopper size of rule {0}.|
|54004|Validator found a profile property in the rule set, but the validator properties list is null.|
|54012|The JSON description of the rule set {0} is invalid.|
|54013|The audience rule set is missing a top level operator.|
|54014|The top level operator {0} must be either any or all.|
|54015|The audience rule set rules array is missing or invalid.|
|54018|The rule operator {0} is not supported. Rule operators must be one of the following: eq, ne, isOneOf, isNotOneOf, contains, containsIgnoreCase, startsWith, startsWithIgnoreCase, endsWith, endsWithIgnoreCase, includesAny, includesAll, notIncludesAny.|
|54019|The operator {0} for an internalAudience rule must be either includesAny, notIncludesAny or includesAll.|
|54020|The value of an enumList rule must be an array.|
|54030|The audience rule set is missing or empty.|
|54034|The audience rule property service was not initialized.|
|54035|The RuleNode at rule {0} must be a RuleTree.|
|54035|The rule set has an error.|
|54036|Rule {0} has an invalid rule tag. The rule tag must be a json object containing a valid category.|
|54036 Rule {0} has an invalid rule tag. ??The rule tag must be a json object containing a valid category.|
|54039|The operator for rule {0} cannot be used with the given value for the rule.|
|54039|Rule {0} has an invalid value for audience {1}.|
|54039|Rule {0} has an invalid audience operator for audience {1}.|
|54039|The operator for rule {0} cannot be used with the given value for the rule.|
|54042|Rule {0} has an invalid operator. ??The operator for an internalAudience rule must be either includesAny, notIncludesAny or includesAll.|
|54042|Rule {0} is not a valid audience rule.|
|54042|Rule {0} has an invalid audience: {1}|
|54043|Rule {0} has an invalid audience: {1}|
|54048|Rule {0} is invalid because it results in a circular audience reference for audience {1}.|
Root Schema : errorModel
Type:
Show Source
object
-
devMessage(optional):
string
An optional non-localized message containing technical information for developers
-
errorCode(optional):
string
The numerical code identifying the error
-
errors(optional):
array errors
An optional list of errors if multiple errors were encountered
-
message(optional):
string
The localized message describing the error
-
moreInfo(optional):
string
An optional non-localized message with more information
-
o:errorPath(optional):
string
An optional machine readable description of where the error occurred
-
status(optional):
string
The HTTP status code
-
type(optional):
string
The URI to the HTTP state code definition
Nested Schema : errors
Type:
array
An optional list of errors if multiple errors were encountered
Show Source
Nested Schema : items
Type:
Show Source
object
-
devMessage(optional):
string
An optional non-localized message containing technical information for developers
-
errorCode(optional):
string
The numerical code identifying the error
-
message(optional):
string
The localized message describing the error
-
moreInfo(optional):
string
An optional non-localized message with more information
-
o:errorPath(optional):
string
An optional machine readable description of where the error occurred
-
status(optional):
string
The HTTP status code