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:
string
The Audience ID. This can be an empty string, but only if the Audience doesn't have an ID yet. - ruleSet
-
Type:
object
ruleSetRequired:true
Additional Properties Allowed:The rule set for the Audience.
Nested Schema : ruleSet
Type:
object
The rule set for the Audience.
- operator
-
Type:
string
Required:true
The operator applied to all of the rules in the rule set. - rules
-
Type:
array
rulesRequired:true
Additional Properties Allowed:The array of rules that make up the rule set.
Nested Schema : rules
Nested Schema : items
Type:
object
- category
-
Type:
string
Required:true
The category of the property, i.e. profile, internalAudience, etc. - operator
-
Type:
string
Required:true
The operator applied to the rule property. - property
-
Type:
string
Required:true
The property to be evaluated. - value
-
Type:
string
Required:true
The 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:
integer
An estimate of the number of registered shoppers in the system. - ruleShopperCounts
-
Type:
array
ruleShopperCountsAdditional 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:
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.
Nested Schema : items
Type:
object
- rules
-
Type:
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
-
Type:
integer
The 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:
string
An optional non-localized message containing technical information for developers - errorCode
-
Type:
string
The numerical code identifying the error - errors
-
Type:
array
errorsAdditional Properties Allowed:An optional list of errors if multiple errors were encountered - message
-
Type:
string
The localized message describing the error - moreInfo
-
Type:
string
An optional non-localized message with more information - o:errorPath
-
Type:
string
An optional machine readable description of where the error occurred - status
-
Type:
string
The HTTP status code - type
-
Type:
string
The URI to the HTTP state code definition
Nested Schema : errors
Nested Schema : items
Type:
object
- devMessage
-
Type:
string
An optional non-localized message containing technical information for developers - errorCode
-
Type:
string
The numerical code identifying the error - message
-
Type:
string
The localized message describing the error - moreInfo
-
Type:
string
An optional non-localized message with more information - o:errorPath
-
Type:
string
An optional machine readable description of where the error occurred - status
-
Type:
string
The 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 } ] }