创建规则。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求头
该接口使用公共请求头,无特殊请求头。请参见公共请求参数文档。
请求语法
POST /v2/openapi/instances/[instanceId]/rules HTTP/1.1
请求参数
名称 | 类型 | 位置 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|---|
instanceId | String | Path | 是 | airec-cn-o400whm78004 |
实例id |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
code | String | InternalServerError |
错误码 |
message | String | An internal server error occurred |
错误详情 |
requestId | String | 8F81A922-6C81-46D6-B78C-CC35E16B1691 |
请求id |
result | Struct |
返回详情结果 |
|
gmtCreate | String | 2020-04-27T06:38:28.000Z |
创建时间 |
gmtModified | String | 2020-04-27T06:38:28.000Z |
最后修改时间 |
ruleId | String | 98493A14-D619-4E88-9F8D-108939817F9F |
规则id |
status | String | true |
开关(true/false) |
示例
请求示例
POST openapi/instances/{instanceId}/rules
请求示例补充说明
```json
// 创建选品规则
{ "type":"SelectionRule",
"ruleMeta":{
"sceneId":"123",
"ruleMetaType":"SELECTION",
"selectionParams":[
{
"selectType":"QUERY_ITEM_TYPE",
"selectionOperation":"QUERY_VALUE_IN",
"selectValue":"[\"atrical\",\"image\"]"
}
]
}
}
// 创建运营规则
{
"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
}
]
}
]
}
}
```
正常返回示例
XML
格式
<0>
<Result>
<Status>DRAFT</Status>
<GmtCreate>2020-04-27T06:38:28.000Z</GmtCreate>
<GmtModified>2020-04-27T06:38:28.000Z</GmtModified>
<RuleId>98493A14-D619-4E88-9F8D-108939817F9F</RuleId>
<RuleMeta>
<RuleMetaType>SELECTION</RuleMetaType>
<SceneId>123</SceneId>
<PubState>PUBLISHING</PubState>
<SelectionParams>
<SelectType>QUERY_ITEM_TYPE</SelectType>
<SelectionOperation>OPERATOR_EQUAL</SelectionOperation>
<SelectValue>atrical,image</SelectValue>
</SelectionParams>
</RuleMeta>
</Result>
<RequestId>76E2C51D-A2D7-4775-9FD8-2AB84B2A0CEF</RequestId>
</0>
<1>
<Result>
<Status>DRAFT</Status>
<GmtCreate>2020-04-27T03:17:21.000Z</GmtCreate>
<GmtModified>2020-04-27T03:17:21.000Z</GmtModified>
<RuleId>123456789001122</RuleId>
<RuleMeta>
<RuleMetaType>OPERATION</RuleMetaType>
<SceneId>123</SceneId>
<PubState>PUBLISHING</PubState>
<OperationParams>
<OperationType>MIX</OperationType>
<Settings>
<Name>image</Name>
<Value>10</Value>
</Settings>
</OperationParams>
<OperationParams>
<OperationType>DIVERSIFY</OperationType>
<CategoryIndex>1</CategoryIndex>
<Window>2</Window>
<Status>true</Status>
<DiversifyType>TYPE_SHOP</DiversifyType>
</OperationParams>
<OperationParams>
<OperationType>EXPOSURE</OperationType>
<ExposureSettings>
<DurationSeconds>12340</DurationSeconds>
<Status>true</Status>
<ExposureType>TYPE_EXPOSE</ExposureType>
<ScenarioBased>true</ScenarioBased>
</ExposureSettings>
<ExposureSettings>
<DurationSeconds>12340000</DurationSeconds>
<Status>true</Status>
<ExposureType>TYPE_CLICK</ExposureType>
<ScenarioBased>true</ScenarioBased>
</ExposureSettings>
</OperationParams>
</RuleMeta>
</Result>
<RequestId>76E2C51D-A2D7-4775-9FD8-2AB84B2A0CEF</RequestId>
</1>
JSON
格式
[{
"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"
},
{
"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"
}
]
错误码
访问错误中心查看更多错误码。