API 文档
文档目录
服务与支持 API 文档 批量添加记录
批量添加记录

1. 接口描述

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

2. 请求参数

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

参数名 是否必须 参数描述
domain_id 域名ID,多个 domain_id 用英文逗号进行分割。
records 待批量添加的记录详情,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: 任务详情,仅将用户的输入补全,并非实际执行结果,开发者可以忽略该字段。
最近更新于 2020-09-08 11:18