<ph type="x-smartling-placeholder"></ph>
您正在查看 Apigee Edge 文档。
转到
Apigee X 文档。 信息
当开发者接近或达到特定上限时,您可以通过电子邮件通知他们 按量分组的价目表方案或套装价目表方案的出价例如,如果开发者 购买包含 1,000 次通话的批量套餐,您可以在客户来电时通知他们 800 次调用(用量占 80%)或 API 调用费用达到 $500 时。
如需使用 API 为费率方案设置限制通知,请执行以下步骤:
自定义通知模板
以下示例展示了如何自定义 用于通知开发者。有关详情,请参阅管理 通知模板。
$ curl -H "Content-Type: application/json " -X POST -d \
'{
"name": "RATE_PLAN_LIMIT_TEMPLATE",
"subject": "Nearing your rate plan limit",
"htmlImage": "<p>Hi ${developer.name} - Wanted to let you know that you have used 800 API calls from your ${ratePlan.displayName} rate plan, which started on ${ratePlan.startDate} under the ${ratePlan.monetizationPackage.displayName} package and ${ratePlan.monetizationPackage.products.displayName} product. Just a friendly reminder that your API calls will be charged double after you cross 1000 calls. Thanks for using the API!</p>",
"source": "Postman API call"
}' \
"https://api.enterprise.apigee.com/v1/mint/organizations/myorg/notification-email-templates" \
-u email:password
配置通知条件和操作
使用 API 配置通知条件和操作,如配置 通知条件和操作。
如需触发速率方案限制的通知,请设置以下属性:
RATEPLAN- 要发送的通知类型。PUBLISHED- 将此属性设置为 TRUE,以便在 发布价格方案
然后,指定以下某个属性:
Transactions- 交易次数。例如,在以下情况下通知开发者: 就会达到 800 笔交易必须是整数值,并且只能大于 >和 = 运算符 允许。FeeExposure- 交易中累计的美元或积分金额。必须为 整数值,并且只有 >且允许使用“=”运算符。FeeExposure不包括设置、周期性或终止费用金额。例如,通知开发者 当 API 交易费用达到 500 美元时FeeExposure计算 因税率而异。
当事务数量达到 800:
$ curl -H "Content-Type:application/json" -X POST -d \
'{
"notificationCondition": [
{
"attribute": "RATEPLAN",
"value": "{RATE_PLAN_ID}"
},
{
"attribute": "PUBLISHED",
"value": "TRUE"
},
{
"attribute": "Transactions",
"value": "= 800"
}
],
"actions": [{
"actionAttribute": "DEV_ID",
"value": "ANY",
"templateId": "{EMAIL_TEMPLATE_ID}"
}]
}' \
"https://api.enterprise.apigee.com/v1/mint/organizations/{org_name}/notification-conditions" \
-u email:password