全部产品
云市场
云游戏

CreateRule

更新时间:2020-08-31 11:24:26

CreateRule

描述

创建规则。

方法

POST

URI

openapi/instances/{instanceId}/rules

请求参数说明

参数 类型 是否必需 描述
type String 规则类型
SelectionRule
OperationRule
ruleMeta Map 规则的具体信息
└sceneId String 场景id
全局运营规则是关键字 global
selectionParams List 选品规则参数
└selectType Enum QUERY_ITEM_TYPE 物品类型
QUERY_CATEGORY 物品类目
QUERY_PUB_TIME 发布时间
QUERY_CHANNEL 渠道
└selectionOperation Enum OPERATORHIGHER 大于等于
OPERATOR_LOWER 小于等于
_QUERY_VALUE_IN 包括
└selectValue String 具体选择的规则(Json格式传递)
operationParams
└operationType Enum MIX 排序
DIVERSIFY 多样性
EXPOSURE 曝光 (只有全局规则支持曝光类型)
└settings MixSetting
└name String 混排类型
└value int 混排类型所占百分比
└diversifyType Enum TYPE_SHOP 店铺打散
TYPE_AUTHOR 作者打散
TYPE_CATEGORY 类目打散
└categoryIndex int 层级,没有填0
└window int 窗口
└status boolean 开关
└exposureSettings List 曝光配置列表
└durationSeconds Long 曝光时间(秒级时间戳)
└exposureType String 曝光类型
TYPE_EXPOSE 曝光
TYPE_CLICK 点击
└status boolean 开关
└scenarioBased boolean 是否基于场景

返回参数

参数 类型 描述
RequestId String 当前请求的RequestID
Result Map 返回详情结果
└RuleId String 返回规则ID

示例

请求示例

  1. POST openapi/instances/{instanceId}/rules
  1. /// 创建选品规则
  2. { "type":"SelectionRule",
  3. "ruleMeta":{
  4. "sceneId":"123",
  5. "ruleMetaType":"SELECTION",
  6. "selectionParams":[
  7. {
  8. "selectType":"QUERY_ITEM_TYPE",
  9. "selectionOperation":"QUERY_VALUE_IN",
  10. "selectValue":"[\"atrical\",\"image\"]"
  11. }
  12. ]
  13. }
  14. }
  15. // 创建运营规则
  16. {
  17. "type":"OperationRule",
  18. "ruleMeta":{
  19. "ruleMetaType":"OPERATION",
  20. "sceneId":"123",
  21. "operationParams":[
  22. {
  23. "operationType":"MIX",
  24. "settings":[
  25. {
  26. "name":"image",
  27. "value":10
  28. }
  29. ]
  30. },
  31. {
  32. "operationType":"DIVERSIFY",
  33. "status":true,
  34. "diversifyType":"TYPE_SHOP",
  35. "categoryIndex":1,
  36. "window":2
  37. },
  38. {
  39. "operationType":"EXPOSURE",
  40. "exposureSettings":[
  41. {
  42. "durationSeconds":1234000,
  43. "status":true,
  44. "exposureType":"TYPE_EXPOSE",
  45. "scenarioBased":true
  46. },
  47. {
  48. "durationSeconds":123400,
  49. "status":true,
  50. "exposureType":"TYPE_CLICK",
  51. "scenarioBased":true
  52. }
  53. ]
  54. }
  55. ]
  56. }
  57. }

返回示例

JSON 格式

  1. // 选品规则
  2. {
  3. "Result":{
  4. "Status":"DRAFT",
  5. "GmtCreate":"2020-04-27T06:38:28.000Z",
  6. "GmtModified":"2020-04-27T06:38:28.000Z",
  7. "RuleId":"98493A14-D619-4E88-9F8D-108939817F9F",
  8. "RuleMeta":{
  9. "RuleMetaType":"SELECTION",
  10. "SceneId":"123",
  11. "PubState":"PUBLISHING",
  12. "SelectionParams":[
  13. {
  14. "SelectType":"QUERY_ITEM_TYPE",
  15. "SelectionOperation":"OPERATOR_EQUAL",
  16. "SelectValue":"atrical,image"
  17. }
  18. ]
  19. }
  20. },
  21. "RequestId":"76E2C51D-A2D7-4775-9FD8-2AB84B2A0CEF"
  22. }
  23. // 运营规则
  24. {
  25. "Result":{
  26. "Status":"DRAFT",
  27. "GmtCreate":"2020-04-27T03:17:21.000Z",
  28. "GmtModified":"2020-04-27T03:17:21.000Z",
  29. "RuleId":"123456789001122",
  30. "RuleMeta":{
  31. "RuleMetaType":"OPERATION",
  32. "SceneId":"123",
  33. "PubState":"PUBLISHING",
  34. "OperationParams":[
  35. {
  36. "OperationType":"MIX",
  37. "Settings":[
  38. {
  39. "Name":"image",
  40. "Value":10
  41. }
  42. ]
  43. },
  44. {
  45. "OperationType":"DIVERSIFY",
  46. "CategoryIndex":1,
  47. "Window":2,
  48. "Status":true,
  49. "DiversifyType":"TYPE_SHOP"
  50. },
  51. {
  52. "OperationType":"EXPOSURE",
  53. "ExposureSettings":[
  54. {
  55. "DurationSeconds":12340,
  56. "Status":true,
  57. "ExposureType":"TYPE_EXPOSE",
  58. "ScenarioBased":true
  59. },
  60. {
  61. "DurationSeconds":12340000,
  62. "Status":true,
  63. "ExposureType":"TYPE_CLICK",
  64. "ScenarioBased":true
  65. }
  66. ]
  67. }
  68. ]
  69. }
  70. },
  71. "RequestId":"76E2C51D-A2D7-4775-9FD8-2AB84B2A0CEF"
  72. }

异常返回示例

JSON 格式

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