All Products
Search
Document Center

ModifyRule

Last Updated: Aug 31, 2021

Description

Modifies a rule.

Method

PUT

URI

openapi/instances/{instanceId}/rules/{ruleId}

Request parameters

Parameter

Type

Required

Description

type

String

Yes

The type of the rule. Valid values: SelectionRule and OperationRule.

ruleMeta

Map

Yes

The specific information of the rule.

└sceneId

String

Yes

The ID of the scene.

selectionParams

List

Yes

The parameters specified for the item selection rule.

└selectType

Enum

Yes

The selection type. Valid values: QUERY_ITEM_TYPE, QUERY_CATEGORY, QUERY_PUB_TIME, and QUERY_CHANNEL.

└selectionOperation

Enum

Yes

OPERATOR_HIGHER Greater than or equal to;

OPERATOR_LOWER Less than or equal to;

QUERY_VALUE_IN contain

└selectValue

String

Yes

Specific selection rules (passed in JSON format)

operationParams

└operationType

Enum

Yes

MIX sort;

DIVERSIFY Diversity;

EXPOSURE Exposure (only global rules support exposure types)

└settings

MixSetting

Yes

└name

String

Yes

Mixed type

└value

int

Yes

Percentage of mixed type

└diversifyType

Enum

Yes

TYPE_SHOP Shop Discretization featurep;

TYPE_AUTHOR author discretization feature;

TYPE_CATEGORY category discretization feature

└categoryIndex

int

Yes

Level, if not, fill in 0

└window

int

Yes

window

└status

boolean

Yes

switch

└exposureSettings

List

Yes

Exposure configuration list

└durationSeconds

Long

Yes

Exposure time (second-level timestamp)

└exposureType

String

Yes

Exposure type:

TYPE_EXPOSE excope;

TYPE_CLICK click;

TYPE_LOOP loop

└status

boolean

Yes

switch

└scenarioBased

boolean

Yes

Whether based on the scene

Response parameters

Parameter

Type

Description

RequestId

String

The ID of the request.

Result

Map

The result that is returned.

└RuleId

String

The ID of the rule.

Examples

Sample requests

PUT openapi/instances/{instanceId}/rules/{ruleId}
// Modify an item selection rule.
{      "type":"SelectionRule",
    "ruleMeta":{
        "sceneId":"123",
        "ruleMetaType":"SELECTION",
        "selectionParams":[
            {
                "selectType":"QUERY_ITEM_TYPE",
                "selectionOperation":"QUERY_VALUE_IN",
                "selectValue":"[\"atrical\",\"image\"]"
            }
        ]
    }
}
// Modify an operations rule.
{
    "type":"OperationRule",
    "ruleMeta":{
        "ruleMetaType":"OPERATION",
        "sceneId":"123",
        "operationParams":[
            {
                "operationType":"MIX",
                "settings":[
                    {
                        "name":"image",
                        "value":10
                    }
                ]
            },
            {
                "operationType":"DIVERSIFY",
                "status":true,
                "diversifyType":"TYPE_SHOP",
                "categoryIndex":1,
                "window":2
            },
            {
                "operationType":"EXPOSURE",
                "exposureSettings":[
                    {
                        "durationSeconds":1234000,
                        "status":true,
                        "exposureType":"TYPE_EXPOSE",
                        "scenarioBased":true
                    },
                    {
                        "durationSeconds":123400,
                        "status":true,
                        "exposureType":"TYPE_CLICK",
                        "scenarioBased":true
                    }
                ]
            }
        ]
    }
}

Sample responses

JSON format

// Item selection rule
{
    "Result":{
        "Status":"DRAFT",
        "GmtCreate":"2020-04-27T06:38:28.000Z",
        "GmtModified":"2020-04-27T06:38:28.000Z",
        "RuleId":"98493A14-D619-4E88-9F8D-108939817F9F",
        "RuleMeta":{
            "RuleMetaType":"SELECTION",
            "SceneId":"123",
            "PubState":"PUBLISHING",
            "SelectionParams":[
                {
                    "SelectType":"QUERY_ITEM_TYPE",
                    "SelectionOperation":"OPERATOR_EQUAL",
                    "SelectValue":"atrical,image"
                }
            ]
        }
    },
    "RequestId":"76E2C51D-A2D7-4775-9FD8-2AB84B2A0CEF"
}


// Operations rule
{
    "Result":{
        "Status":"DRAFT",
        "GmtCreate":"2020-04-27T03:17:21.000Z",
        "GmtModified":"2020-04-27T03:17:21.000Z",
        "RuleId":"123456789001122",
        "RuleMeta":{
            "RuleMetaType":"OPERATION",
            "SceneId":"123",
            "PubState":"PUBLISHING",
            "OperationParams":[
                {
                    "OperationType":"MIX",
                    "Settings":[
                        {
                            "Name":"image",
                            "Value":10
                        }
                    ]
                },
                {
                    "OperationType":"DIVERSIFY",
                    "CategoryIndex":1,
                    "Window":2,
                    "Status":true,
                    "DiversifyType":"TYPE_SHOP"
                },
                {
                    "OperationType":"EXPOSURE",
                    "ExposureSettings":[
                        {
                            "DurationSeconds":12340,
                            "Status":true,
                            "ExposureType":"TYPE_EXPOSE",
                            "ScenarioBased":true
                        },
                        {
                            "DurationSeconds":12340000,
                            "Status":true,
                            "ExposureType":"TYPE_CLICK",
                            "ScenarioBased":true
                        }
                    ]
                }
            ]
        }
    },
    "RequestId":"76E2C51D-A2D7-4775-9FD8-2AB84B2A0CEF"
}

Sample error responses

JSON format

{
    "Code": "InstanceNotFound",
    "Message": "The specified instance does not exist. Check the instanceId please.",
    "RequestId": "829F38F6-E2D6-4109-90A6-888160BD16C2"
}