基于规则的商品推广竞价 API 入门操作
基于规则的竞价由商品推广 API 中的 campaignOptimization 资源来表示。
该 API 包括创建、读取、更新和删除 campaignOptimization
资源的操作。您还可以查询campaignOptimization
资源的状态,确定广活动的适用性,并获取 ROAS 保护机制。
创建规则
您可以通过将主题设置为“在保持 ROAS 保护机制的同时增加对话”来创建规则。您可以用本地货币来设置适用于多个广告活动的 ROAS 保护机制。然后,您应将规则关联到一组广告活动。
POST /sp/rules/campaignOptimization
请求体:
{
"recurrence": "DAILY",
"ruleAction": "ADOPT",
"ruleCondition": [
{
"metricName": "ROAS",
"comparisonOperator": "GREATER_THAN",
"threshold": "4"
}
],
"ruleType": "BID",
"ruleName": "RuleROAS4",
"campaignIds": [
"123784",
"1223785"
]
}
响应体:
{
"campaignOptimizationId": "string",
"code": "string",
"details": "string"
}
注意
Recurrence 属性目前仅支持
DAILY
值。ruleAction
属性目前仅支持ADOPT
值。虽然comparisonOperator
是一个具有多个值的枚举,但如果将metricName
设置为ROAS
,则支持的值为GREATER_THAN
或EQUAL_TO
。
检索规则
要通过标识符检索规则,请使用 GET
操作,并在路径中指定标识符:
GET /sp/rules/campaignOptimization/{campaignOptimizationId}/
响应体:
{
"CampaignOptimizationRule": {
"recurrence": "DAILY",
"ruleAction": "ADOPT",
"campaignOptimizationId": "string",
"createdDate": "2021-04-20T01:09:04.505Z",
"ruleCondition": [
{
"metricName": "ROAS",
"comparisonOperator": "EQUAL",
"threshold": "3",
}
],
"ruleType": "BID",
"ruleName": "string",
"campaignIds": [
"string"
],
"ruleStatus": "ACTIVE"
}
}
注意
'ruleStatus' 属性是一个枚举,目前仅支持两个值:
[ACTIVE, ARCHIVED]
。
规则更新
要更新规则,请使用 PUT
操作:
PUT /sp/rules/campaignOptimization
请求体:
{
"recurrence": "DAILY",
"ruleAction": "ADOPT",
"campaignOptimizationId": "10001",
"ruleCondition": [
{
"metricName": "ROAS",
"comparisonOperator": " EQUALS ",
"threshold": "3"
}
],
"ruleType": "BID",
"ruleName": "RuleROAS4",
"campaignIds": [
"123784",
"1223785"
]
}
响应体:
{
"campaignOptimizationId": "string",
"code": "string",
"details": "string"
}
规则删除
要通过标识符删除规则,请使用 DELETE
操作,并在路径中指定标识符:
DELETE /sp/rules/campaignOptimization/{campaignOptimizationId}/
响应体:
{
"campaignOptimizationId": "string",
"code": "string",
"details": "string"
}
规则状态
您可以通过在请求体中指定一个 campaignIds
列表来查询与广告活动关联的规则的状态,该请求使用的资源是 campaignOptimation/state
。
POST /sp/rules/campaignOptimization/state
请求体:
{
"campaignIds": [
"string"
]
}
响应体:
{
"CampaignOptimizationRecommendationsError": [
{
"campaignId": "string",
"Error": {
"code": "string",
"details": "string"
}
}
],
"CampaignOptimizationNotifications": [
{
"ruleState": "ENABLED",
"campaignOptimizationId": "string",
"campaignId": "string",
"notificationString": "string"
}
]
}
注意
我们建议您每天至少执行一次此查询。
使用资格
要确定某个广告活动是否符合基于规则的竞价资格,请使用 POST
操作获取 campaignOptimization/eligibility
资源。如果广告活动符合资格,则响应中将包括给定广告活动标识符的 ROAS 和竞价保护机制指南。响应数据基于与您相似的广告主的历史广告活动效果。
POST /sp/rules/campaignOptimization/eligibility
请求体:
{
"campaignIds": [
"string"
]
}
响应体:
{
"CampaignOptimizationRecommendations": [
{
"campaignId": "string",
"performanceMetrics": {
"roas": 0
}
}
],
"CampaignOptimizationRecommendationsError": [
{
"campaignId": "string",
"Error": {
"code": "string",
"details": "string"
}
}
]
}