V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Microcharon
V2EX  ›  Cloudflare

测试使用 Cloudflare API 来删除 DNS 记录报错

  •  
  •   Microcharon · 2023-02-07 17:23:16 +08:00 · 1400 次点击
    这是一个创建于 688 天前的主题,其中的信息可能已经有所发展或是发生改变。

    测试使用 Cloudflare 的 API 来删除对应域名的 DNS 记录,对应的测试域名中有预先添加一条 A 记录

    https://api.cloudflare.com/#dns-records-for-a-zone-delete-dns-record

    curl -X DELETE "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$DNS_ID" \
         -H "X-Auth-Email: $EMAIL" \
         -H "X-Auth-Key: $GLOBAL_KEY" \
         -H "Content-Type: application/json"
    

    报错如下,提示没有 DNS 记录

    {"result":null,"success":false,"errors":[{"code":81044,"message":"Record does not exist."}],"messages":[]}
    

    疑惑了很久,不清楚为什么会出错,求大佬解答

    2 条回复    2023-02-07 17:48:19 +08:00
    bootvue
        1
    bootvue  
       2023-02-07 17:28:22 +08:00
    先 list /details 查询一下 看有没有
    Microcharon
        2
    Microcharon  
    OP
       2023-02-07 17:48:19 +08:00
    @bootvue

    谢谢,list 出测试域名的 DNS 记录后才发现原来是 DNS_ID 和 ACCOUNT_ID (账户 ID )混淆了,以为 DNS_ID 就是 ACCOUNT_ID ,列出来才知道 DNS_ID ,这下 success 了

    {"result":[{"id":"bd8401829beac46cf0zc44ce93407a05","zone_id":"1659x52d329x1519x9e6x36cc40a56bf","zone_name":"jazzcat.eu.org","name":"jazzcat.eu.org","type":"A","content":"107.185.3.1","proxiable":true,"proxied":true,"ttl":1,"locked":false,"meta":{"auto_added":false,"managed_by_apps":false,"managed_by_argo_tunnel":false,"source":"primary"},"comment":null,"tags":[],"created_on":"2023-02-07T07:48:26.041466Z","modified_on":"2023-02-07T07:48:26.041466Z"}],"success":true,"errors":[],"messages":[],"result_info":{"page":1,"per_page":100,"count":1,"total_count":1,"total_pages":1}}
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1092 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 117ms · UTC 19:02 · PVG 03:02 · LAX 11:02 · JFK 14:02
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.