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
Body Parameter
Root Schema : audienceSizes_request
{
"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"
}
- id
-
Type:
stringThe Audience ID. This can be an empty string, but only if the Audience doesn't have an ID yet. - ruleSet
-
Type:
objectruleSetRequired:trueAdditional Properties Allowed:The rule set for the Audience.
Nested Schema : ruleSet
Type:
objectThe rule set for the Audience.
- operator
-
Type:
stringRequired:trueThe operator applied to all of the rules in the rule set. - rules
-
Type:
arrayrulesRequired:trueAdditional Properties Allowed:The array of rules that make up the rule set.
Nested Schema : rules
Nested Schema : items
Type:
object- category
-
Type:
stringRequired:trueThe category of the property, i.e. profile, internalAudience, etc. - operator
-
Type:
stringRequired:trueThe operator applied to the rule property. - property
-
Type:
stringRequired:trueThe property to be evaluated. - value
-
Type:
stringRequired:trueThe value used to compare against the property value to determine the rule result.
Response
Supported Media Types
- application/json
200 Response
Following model is returned when operation succeeds.
Body
Root Schema : audienceSizes_response
- registeredShoppers
-
Type:
integerAn estimate of the number of registered shoppers in the system. - ruleShopperCounts
-
Type:
arrayruleShopperCountsAdditional Properties Allowed: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.
Nested Schema : ruleShopperCounts
Type:
arrayAn 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.
Nested Schema : items
Type:
object- rules
-
Type:
stringA 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
-
Type:
integerThe estimated number of shoppers the Audience would contain after executing the rules specified in the "rules" string.
Example 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.|
|54016|Audience rule at index {0} is invalid.|
|54016|An error occurred while building the shopper size query for rule {0}.|
|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}.|
Body
Root Schema : errorModel
Type:
object- devMessage
-
Type:
stringAn optional non-localized message containing technical information for developers - errorCode
-
Type:
stringThe numerical code identifying the error - errors
-
Type:
arrayerrorsAdditional Properties Allowed:An optional list of errors if multiple errors were encountered - message
-
Type:
stringThe localized message describing the error - moreInfo
-
Type:
stringAn optional non-localized message with more information - o:errorPath
-
Type:
stringAn optional machine readable description of where the error occurred - status
-
Type:
stringThe HTTP status code - type
-
Type:
stringThe URI to the HTTP state code definition
Nested Schema : errors
Nested Schema : items
Type:
object- devMessage
-
Type:
stringAn optional non-localized message containing technical information for developers - errorCode
-
Type:
stringThe numerical code identifying the error - message
-
Type:
stringThe localized message describing the error - moreInfo
-
Type:
stringAn optional non-localized message with more information - o:errorPath
-
Type:
stringAn optional machine readable description of where the error occurred - status
-
Type:
stringThe HTTP status code
Examples
Sample Request:
{
"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"
}
Sample Response Payload returned by endpoint:
{
"registeredShoppers": 1234,
"ruleShopperCounts": [
{
"rules": "1",
"shoppers": 100
},
{
"rules": "1,2",
"shoppers": 75
},
{
"rules": "1,2,3",
"shoppers": 40
}
]
}