API 文档
文档目录
    加载中
文档中心 API 文档 批量添加记录

批量添加记录

注意:本页面提供 API 文档为 DNSPod 传统 API ,仅支持 DNSPod Token。仅限主账号调用,子账号不可用。 推荐使用 腾讯云 API 3.0 ,支持 CAM 权限管理,同时支持主账号、子账号调用。兼容腾讯云 API 密钥,提供 API Explorer、API 调用统计等工具,还可以与腾讯云其他产品更好协同使用。

1. 接口描述

本接口 Batch.Record.Create 批量添加记录。
接口请求地址:https://dnsapi.cn/Batch.Record.Create
HTTP请求方式:POST

2. 请求参数

以下请求参数列表仅列出了接口请求参数,正式调用时需要加上公共请求参数,见 公共请求参数 页面。

参数名 是否必须 类型 参数描述
domain_id Integer 域名ID,多个 domain_id 用英文逗号进行分割。
records String 待批量添加的记录详情,JSON 字符串。

records 示例:

[{“sub_domain”:”www,wap,bbs”,”record_type”:”A”,”record_line”:”默认”,”value”:”11.22.33.44”,”ttl”:600}]
[{“sub_domain”:”www,wap,bbs”,”record_type”:”A”,”record_line”:”默认”,”value”:”11.22.33.44”,”ttl”:600},{“sub_domain”:””,”record_type”:”MX”,”record_line”:”默认”,”value”:”mx.qq.com”,”ttl”:600,”MX”:10}]

3. 响应代码

以下请求参数列表仅列出了此接口请求响应代码,除此接口请求响应代码外。还包含 共通返回

响应码 描述
共通返回【具体错误信息参见 message 字段】。

4. 示例

curl -X POST https://dnsapi.cn/Batch.Record.Create -d 'login_token=LOGIN_TOKEN&format=json&records=[{"sub_domain":"www,wap,bbs","record_type":"A","record_line":"默认","value":"11.22.33.44","ttl":600},{"sub_domain":"","record_type":"MX","record_line":"默认","value":"mx.qq.com","ttl":600,"MX":10}]&domain_id=25556994,25556952'

返回示例如下:

  • JSON:
{
    "status": {
        "code": "1",
        "message": "Action completed successful",
        "created_at": "2015-09-08 17:38:09"
    },
    "job_id": "49590",
    "detail": [
        {
            "id": 0,
            "domain_id": "16",
            "domain": "wuhongsheng.com",
            "domain_grade": "DP_Free",
            "err_msg": null,
            "status": "waiting",
            "operation": null,
            "records": [
                {
                    "id": 0,
                    "sub_domain": "www",
                    "record_type": "A",
                    "area": "默认",
                    "value": "11.22.33.44",
                    "mx": "5",
                    "ttl": "600",
                    "err_msg": null,
                    "status": "waiting",
                    "operation": "plus"
                },
                {
                    "id": 1,
                    "sub_domain": "wap",
                    "record_type": "A",
                    "area": "默认",
                    "value": "11.22.33.44",
                    "mx": "5",
                    "ttl": "600",
                    "err_msg": null,
                    "status": "waiting",
                    "operation": "plus"
                },
                {
                    "id": 2,
                    "sub_domain": "bbs",
                    "record_type": "A",
                    "area": "默认",
                    "value": "11.22.33.44",
                    "mx": "5",
                    "ttl": "600",
                    "err_msg": null,
                    "status": "waiting",
                    "operation": "plus"
                },
                {
                    "id": 3,
                    "sub_domain": "",
                    "record_type": "MX",
                    "area": "默认",
                    "value": "mx.qq.com",
                    "mx": "5",
                    "ttl": "600",
                    "err_msg": null,
                    "status": "waiting",
                    "operation": "plus"
                }
            ]
        },
        {
            "id": 1,
            "domain_id": "20",
            "domain": "dnspod.com",
            "domain_grade": "D_Ultra",
            "err_msg": null,
            "status": "waiting",
            "operation": null,
            "records": [
                {
                    "id": 0,
                    "sub_domain": "www",
                    "record_type": "A",
                    "area": "默认",
                    "value": "11.22.33.44",
                    "mx": "5",
                    "ttl": "600",
                    "err_msg": null,
                    "status": "waiting",
                    "operation": "plus"
                },
                {
                    "id": 1,
                    "sub_domain": "wap",
                    "record_type": "A",
                    "area": "默认",
                    "value": "11.22.33.44",
                    "mx": "5",
                    "ttl": "600",
                    "err_msg": null,
                    "status": "waiting",
                    "operation": "plus"
                },
                {
                    "id": 2,
                    "sub_domain": "bbs",
                    "record_type": "A",
                    "area": "默认",
                    "value": "11.22.33.44",
                    "mx": "5",
                    "ttl": "600",
                    "err_msg": null,
                    "status": "waiting",
                    "operation": "plus"
                },
                {
                    "id": 3,
                    "sub_domain": "",
                    "record_type": "MX",
                    "area": "默认",
                    "value": "mx.qq.com",
                    "mx": "5",
                    "ttl": "600",
                    "err_msg": null,
                    "status": "waiting",
                    "operation": "plus"
                }
            ]
        }
    ]
}
  • 字段说明:
  • job_id: 任务ID,批量操作为异步执行,拿到 job_id 说明批量操作已经成功加入到任务队列,可通过 Batch.Detail 接口异步去查询执行结果。
  • detail: 任务详情,仅将用户的输入补全,并非实际执行结果,开发者可以忽略该字段。
最近更新于 2022-01-24 11:44

DNSPod 域名检测工具

查询域名信息,快速排查网站问题

网站自助排障

快速判断问题、提供合适的解决方案