curl --request POST \
--url https://api.brightdata.com/dca/auto_self_healing/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"collector": "c_abc123",
"enabled": true,
"sr_threshold": 50,
"trigger_frequency": "per_day"
}
'{
"id": "ash_lz3k9qw1"
}{
"validation_errors": [
"Collector must be active"
]
}"collector_not_found"启用自动自我修复
使用 Bright Data Scraper Studio AI Flow API 为爬虫启用自动自我修复,并设置成功率阈值、触发频率、冷却时间和每日作业上限。
curl --request POST \
--url https://api.brightdata.com/dca/auto_self_healing/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"collector": "c_abc123",
"enabled": true,
"sr_threshold": 50,
"trigger_frequency": "per_day"
}
'{
"id": "ash_lz3k9qw1"
}{
"validation_errors": [
"Collector must be active"
]
}"collector_not_found"ash_lz3k9qw1,而不是设置内容本身。
- 每个请求都必须发送
collector、enabled、sr_threshold和trigger_frequency。当trigger_frequency为per_job时,还需发送min_inputs_threshold。 - 只能发送整数,小数会被拒绝。
- 爬虫必须处于活跃状态。非活跃的爬虫会返回 HTTP 400 和
Collector must be active。 notification_emails中的每个地址都必须属于该爬虫所在账户下的用户。
auto_save 为 false 时,请设置 notification_emails。此时修复作业会运行但不会保存代码,通知邮件是相关人员看到建议修复方案的唯一途径。授权
Use your Bright Data API Key as a Bearer token in the Authorization header.
How to authenticate:
- Obtain your API Key from the Bright Data account settings at https://brightdata.com/cp/setting/users
- Include the API Key in the Authorization header of your requests
- Format:
Authorization: Bearer YOUR_API_KEY
Example:
Authorization: Bearer b5648e1096c6442f60a6c4bbbe73f8d2234d3d8324554bd6a7ec8f3f251f07df
Learn how to get your Bright Data API key: https://docs.brightdata.com/api-reference/authentication
请求体
ID of the Scraper Studio scraper to configure, in the c_ format. Required.
"c_abc123"
true turns Auto Self-Healing on for the scraper, false saves the settings with Auto Self-Healing off. Required. Send false here to keep it off, because this endpoint cannot be called a second time to disable it later.
true
Success rate percentage below which Auto Self-Healing triggers, from 1 to 70. At 50, a healing job can start once the scraper's success rate falls below 50 percent. Required, with no default. Decimals are rejected.
1 <= x <= 7050
How often Scraper Studio checks the trigger rules. per_day checks once per day. per_job checks on every job run. Required. Any other value returns HTTP 400.
per_day, per_job "per_day"
Minimum number of job inputs required before Auto Self-Healing triggers, 10 or higher. A job with fewer inputs does not start a healing job. Required with trigger_frequency: per_job. Optional with per_day, which does not use it: the server stores 10 when the field is omitted, and null is accepted.
x >= 10100
When true, any successful healing job saves the newly extracted code to production and updates the scraper's template version, with no human review. When false, the healing job runs but the generated code is not saved. Defaults to false.
true
Minimum hours to wait between consecutive Auto Self-Healing triggers for the scraper, 1 or higher. Send null for no cooldown. Defaults to 3.
x >= 15
Maximum number of Auto Self-Healing jobs allowed for the scraper in one day, from 1 to 24. Send null for no daily limit. Defaults to 8. A failed healing job still counts toward this limit and still starts the cooldown period.
1 <= x <= 243
Email addresses that receive the Auto Self-Healing notifications for this scraper. Each address must belong to a user on the collector's account. Defaults to an empty array, which leaves nobody to review a fix when auto_save is false.
["data-team@example.com"]
响应
Auto Self-Healing settings saved
ID of the saved Auto Self-Healing settings.
"ash_lz3k9qw1"
此页面对您有帮助吗?