API - Smart Rule

Description
These APIs are used to perform CRUD operations on the Smart Rules.
Get All Smart Rules for Strategy
GET /Campaign/api/interact/rest/v2/channels/{icIdOrName}/strategies/{strategyIdOrName}/rules?page=0&size=50
Request Parameters
Parameters Description Default Values
page

number, nth page to retrieve records.

0
size number of records per page. 50
abtOnly Optional. If it is true, only smart rules that have A/B testing data returned. false
Output
Table 1. Response Codes
Success 200 Ok
Error 400 Inputs provided for the API are not valid.
Server Error 500 Internal Server Error. For more details, check the logs.
Example: Content-Type: application/json
{
    "content": [
	{
		"id": 0,
		"ruleName": "string",
		"segmentName": "string",
		"cellCode": "string",
		"zoneName": "string",
		"offerName": "string",
		"offerCode": "string",
		"score": 50,
		"scorePredicateEnabled": true,
		"enabled": true,
		"eligibilityPredicateEnabled": true,
		"effectiveDate": long,
		"expirationDate": long,
		"learningMode": 0,
		"lmName": "string",
		"maxScore": true,
		"suppressCount": 0,
		"segmentId": 0,
		"cellId": 0,
		"zoneId": 0,
		"offerId": 0,
		"scorePredicateId": 0,
		"eligibilityPredicateId": 0,
		"learningModelId": 0,
		"offerAttrExpressions": [
			{
				"attrId": 0,
				"attrName": "string",
				"expression": "string"
			}
		],
		"ruleGroups": [
			{
				"id": 0,
				"name": "string"
			}
		],
		"hasABTest": true,
		"abTest": {
			"enabled": true,
			"effectiveDate": long,
			"expirationDate": long,
			"branches": [
				{
					"branchId": 0,
					"branchName": "string",
					"enabled": true,
					"isDefault": true,
					"samplePercent": 40,
					"cellId": 0,
					"cellCode": "string",
					"offerId": 0,
					"offerName": "string",
					"offerAttributes": [],
					"delete": false
				}
			]
		}
	}],
"page": {
        "pageNumber": 0,
        "totalElements": 0,
        "totalPages": 0,
        "size": 50,
        "hasNext": false,
        "hasPrev": false
    	}
}
Get Smart Rule by Rule Id or Name
GET /Campaign/api/interact/rest/v2/channels/{icIdOrName}/strategies/{strategyIdOrName}/rules/{ruleIdOrName}
Output
Table 2. Response Codes
Success 200 Ok
Error 400 Inputs provided for the API are not valid.
Server Error 500 Internal Server Error. For more details, check the logs.
Example response: Content-Type: application/json

{
	"id": 0,
	"ruleName": "string",
	"segmentName": "string",
	"cellCode": "string",
	"zoneName": "string",
	"offerName": "string",
	"offerCode": "string",
	"score": 50,
	"scorePredicateEnabled": true,
	"enabled": true,
	"eligibilityPredicateEnabled": true,
	"effectiveDate": long,
	"expirationDate": long,
	"learningMode": 0,
	"lmName": "string",
	"maxScore": true,
	"suppressCount": 0,
	"segmentId": 0,
	"cellId": 0,
	"zoneId": 0,
	"offerId": 0,
	"scorePredicateId": 0,
	"eligibilityPredicateId": 0,
	"learningModelId": 0,
	"offerAttrExpressions": [
		{
			"attrId": 0,
			"attrName": "string",
			"expression": "string"
		}
	],
	"ruleGroups": [
		{
			"id": 0,
			"name": "string"
		}
	],
	"hasABTest": true,
	"abTest": {
		"enabled": true,
		"effectiveDate": long,
		"expirationDate": long,
		"branches": [
			{
				"branchId": 0,
				"branchName": "string",
				"enabled": true,
				"isDefault": true,
				"samplePercent": 40,
				"cellId": 0,
				"cellCode": "string",
				"offerId": 0,
				"offerName": "string",
				"offerAttributes": [],
				"delete": false
			}
		]
	}		
}
Create, Update, and Delete Smart Rules
POST /Campaign/api/interact/rest/v2/channels/{icIdOrName}/strategies/{strategyIdOrName}/rules
Input
Body Parameter – Content-Type:application/json
{
  "toAdd": [
  {
	"id": 0,
	"ruleName": "string",
	"score": 50,
	"scorePredicateEnabled": true,
	"enabled": true,
	"eligibilityPredicateEnabled": true,
	"effectiveDate": long,
	"expirationDate": long,
	"learningMode": 0,
	"maxScore": true,
	"suppressCount": 0,
	"segmentId": 0,
	"cellId": 0,
	"zoneId": 0,
	"offerId": 0,
	"scorePredicateId": 0,
	"eligibilityPredicateId": 0,
	"learningModelId": 0,
	"offerAttrExpressions": [
		{
			"attrId": 0,
		"expression": "string"
	}
],
"ruleGroups": [
	{
		"id": 0,
	}
],
"abTest": {
		"enabled": true,
		"effectiveDate": long,
		"expirationDate": long,
		"branches": [
			{
				"branchId": 0,
				"branchName": "string",
				"enabled": true,
				"isDefault": true,
				"samplePercent": 40,
				"cellId": 0,
				"offerId": 0,
				"offerAttributes": [
				{
					"attrId": 0,
				"expression": "string"
			}]
			}
		]
 }
]
}
"toUpdate": [
{
 "id": 0,
	"ruleName": "string",
	"score": 50,
	"scorePredicateEnabled": true,
	"enabled": true,
	"eligibilityPredicateEnabled": true,
	"effectiveDate": long,
	"expirationDate": long,
	"learningMode": 0,
	"maxScore": true,
	"suppressCount": 0,
	"segmentId": 0,
	"cellId": 0,
	"zoneId": 0,
	"offerId": 0,
	"scorePredicateId": 0,
	"eligibilityPredicateId": 0,
	"learningModelId": 0,
	"offerAttrExpressions": [
		{
			"attrId": 0,
		"expression": "string"
	}
],
"ruleGroups": [
	{
		"id": 0,
	}
]
}
   ],
"toDelete": [ 0
],
Output
Table 3. Response Codes
Success 201 Created
Error 400 Bad Request
Server Error 500 Internal/Server Error
Delete Smart Rules
DELETE /Campaign/api/interact/rest/v2/channels/{icIdOrName}/strategies/{strategyIdOrName}/rules
Request Parameters
Parameters Description
ids Comma separated Smart Rule IDs to be deleted.
Output
Table 4. Response Codes
Success 200 Ok
Error 400 Bad Request
Server Error 500 Internal/Server Error