追踪域名
用户需要在 SendCloud 中配置发信域名才能正常的发送邮件.
你可以使用 API 进行追踪域名的查询, 添加, 修改操作
查询 ( 批量查询 )
通过此接口查询追踪域名信息
URL
https://api.sendcloud.net/apiv2/trackDomain/list
HTTP请求方式
post get
参数说明
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| apiUser | string | 是 | API_USER |
| apiKey | string | 是 | API_KEY |
| name | string | 否 | 追踪域名的名称,多个 name 用 ; 分隔 |
| start | int | 否 | 查询起始位置,取值区间 [0-],默认为 0 |
| limit | int | 否 | 查询个数,取值区间 [0-100],默认为 100 |
请求示例
https://api.sendcloud.net/apiv2/trackDomain/list?apiUser=***&apiKey=***&name=ifaxin.com
返回值说明
| 参数 | 说明 |
|---|---|
| id | 追踪域名ID |
| name | 追踪域名的名称 |
| cname | cname是否已配置通过,true:已通过 false:未通过 |
| gmtCreated | 追踪域名创建时间 |
| gmtUpdated | 追踪域名修改时间 |
| cname.domain | 追踪域名的主机记录 |
| cname.value | 追踪域名需配置的记录值 |
| https | https配置状态 true:已配置 false:未配置 |
| certiValidityStart | SSL证书有效期的开始时间( yyyy-MM-dd HH:mm:ss) |
| certiValidityEnd | SSL证书有效期的结束时间( yyyy-MM-dd HH:mm:ss) |
返回值示例
{
"info": {
"dataList": [
{
"id": 999225,
"name": "track2.test.com",
"cname": false,
"gmtCreated": "2014-11-01 22:41:52",
"gmtUpdated": "2015-09-25 10:56:06",
"cname.domain": "test.com",
"cname.value": "test.com",
"https": false,
"certiValidityStart": "",
"certiValidityEnd": ""
},
{
"id": 999224,
"name": "track.test.com",
"cname": false,
"gmtCreated": "2014-11-01 22:41:52",
"gmtUpdated": "2015-09-25 10:56:06",
"cname.domain": "test.com",
"cname.value": "test.com",
"https": false,
"certiValidityStart": "",
"certiValidityEnd": ""
}
],
"total": 2,
"count": 2
},
"statusCode": 200,
"message": "request was successful",
"result": true
}
添加
通过此接口添加追踪域名
URL
https://api.sendcloud.net/apiv2/trackDomain/add
HTTP请求方式
post get
参数说明
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| apiUser | string | 是 | API_USER |
| apiKey | string | 是 | API_KEY |
| name | string | 是 | 追踪域名的名称,符合域名规范要求,长度不超过255个字符 |
| certContent | string | 否 | 证书内容(PEM格式) |
| certKey | string | 否 | 证书私钥(PEM格式) |
说明
1. 追踪域名不能与任一发信域名相同。
2. certContent 和 certKey,必须同时为空或者同时传值。
3. 同一个用户最多能添加 5 个追踪域名,如需添加超过5个追踪域名,请与客服联系。
请求示例
https://api.sendcloud.net/apiv2/trackDomain/add?apiUser=***&apiKey=***&name=mail.liubida.cn
返回值说明
| 参数 | 说明 |
|---|---|
| name | 域名名称 |
| type | 域名类型 |
| verify | 域名验证值 |
| spf.domain | 此域名 SPF 的主机记录 |
| spf.value | 此域名 SPF 的需配置值 |
| dkim.domain | 此域名 DKIM 的主机记录 |
| dkim.value | 此域名 DKIM 的需配置值 |
| mx.domain | 此域名 MX 的主机记录 |
| mx.value | 此域名 MX 的需配置值 |
| dmarc.domain | 此域名 Dmarc 的主机记录 |
| dmarc.value | 此域名 Dmarc 的需配置值 |
| gmtCreated | 域名创建时间 |
| gmtUpdated | 域名修改时间 |
返回值示例
{
"statusCode": 200,
"info": {
"data": {
"name": "test01.shanshan.cn",
"type": "普通",
"verify": 30,
"spf.domain": "test01.shanshan.cn",
"spf.value": "v=spf1 include:spf.sendcloud.org -all",
"dkim.domain": "mail._domainkey.test01.shanshan.cn",
"dkim.value": "k=rsa;p=***",
"mx.domain": "test01.shanshan.cn",
"mx.value": "mx.sendcloud.org",
"dmarc.domain": "_dmarc.test01.shanshan.cn",
"dmarc.value": "v=DMARC1;p=reject;ruf=mailto:dmarc@test01.shanshan.cn;rua=mailto:dmarc_report@test01.shanshan.cn",
"gmtCreated": "2014-11-01 22:41:52",
"gmtUpdated": "2015-09-25 10:56:06"
}
},
"message“: "请求成功",
"result": true
}
修改
通过此接口修改追踪域名
URL
https://api.sendcloud.net/apiv2/trackDomain/update
HTTP请求方式
post get
参数说明
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| apiUser | string | 是 | API_USER |
| apiKey | string | 是 | API_KEY |
| id | Integer | 是 | 追踪域名ID |
| name | string | 否 | 新追踪域名的名称 |
| certContent | string | 否 | 证书内容(PEM格式) |
| certKey | string | 否 | 证书私钥(PEM格式) |
请求示例
https://api.sendcloud.net/apiv2/domain/trackDomain/update?apiUser=***&apiKey=***&id=3626&name=mail.liubida.cn
返回值说明
| 参数 | 说明 |
|---|---|
| d | 追踪域名ID |
| name | 追踪域名的名称 |
| cname | cname是否已配置通过,true:已通过 false:未通过 |
| gmtCreated | 追踪域名创建时间 |
| gmtUpdated | 追踪域名修改时间 |
| cname.domain | 追踪域名的主机记录 |
| cname.value | 追踪域名需配置的记录值 |
| https | https配置状态 true:已配置 false:未配置 |
| certiValidityStart | SSL证书有效期的开始时间( yyyy-MM-dd HH:mm:ss) |
| certiValidityEnd | SSL证书有效期的结束时间( yyyy-MM-dd HH:mm:ss) |
返回值示例
{
"result": true,
"statusCode": 200,
"message": "request was successful",
"info": {
data: {
"id": 999224,
"name": "track.test.com",
"cname": false,
"gmtCreated": "2014-11-01 22:41:52",
"gmtUpdated": "2015-09-25 10:56:06",
"cname.domain": "test.com",
"cname.value": "test.com",
"https": false,
"certiValidityStart": "",
"certiValidityEnd": ""
}
}
}
删除
通过此接口删除追踪域名
URL
https://api.sendcloud.net/apiv2/trackDomain/delete
HTTP请求方式
post get
参数说明
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| apiUser | string | 是 | API_USER |
| apiKey | string | 是 | API_KEY |
| id | Integer | 是 | 追踪域名ID |
请求示例
https://api.sendcloud.net/apiv2/domain/trackDomain/delete?apiUser=***&apiKey=***&id=34926
返回值说明
| 参数 | 说明 |
|---|---|
| count | 成功删除追踪域名个数 |
返回值示例
{
"statusCode": 200,
"info": {
"count": 1
},
"message": "请求成功",
"result": true
}
验证
通过此接口验证域名(数据每5min更新一次)
URL
https://api.sendcloud.net/apiv2/trackDomain/checkConfig
HTTP请求方式
post get
参数说明
| 参数 | 类型 | 必须 | 说明 |
|---|---|---|---|
| apiUser | string | 是 | API_USER |
| apiKey | string | 是 | API_KEY |
| id | string | 否 | 追踪域名ID,多个 id 用 ; 分隔 |
| name | string | 否 | 追踪域名的名称,多个 name 用 ; 分隔 |
说明
1. 此接口在调用时会触发cname的状态更新。
2. id 和 name 不能同时为空。
请求示例
https://api.sendcloud.net/apiv2/trackDomain/checkConfig?apiUser=***&apiKey=***&id=56807
返回值说明
| 参数 | 说明 |
|---|---|
| id | 追踪域名ID |
| name | 追踪域名的名称 |
| cname | cname是否已配置通过,true:已通过 false:未通过 |
| gmtCreated | 追踪域名创建时间 |
| gmtUpdated | 追踪域名修改时间 |
| cname.domain | 追踪域名的主机记录 |
| cname.value | 追踪域名需配置的记录值 |
| https | https配置状态 true:已配置 false:未配置 |
| certiValidityStart | SSL证书有效期的开始时间( yyyy-MM-dd HH:mm:ss) |
| certiValidityEnd | SSL证书有效期的结束时间( yyyy-MM-dd HH:mm:ss) |
返回值示例
{
"info": {
"dataList": [
{
"id": 999225,
"name": "track2.test.com",
"cname": false,
"gmtCreated": "2014-11-01 22:41:52",
"gmtUpdated": "2015-09-25 10:56:06",
"cname.domain": "test.com",
"cname.value": "test.com",
"https": false,
"certiValidityStart": "",
"certiValidityEnd": ""
},
{
"id": 999224,
"name": "track.test.com",
"cname": false,
"gmtCreated": "2014-11-01 22:41:52",
"gmtUpdated": "2015-09-25 10:56:06",
"cname.domain": "test.com",
"cname.value": "test.com",
"https": false,
"certiValidityStart": "",
"certiValidityEnd": ""
}
],
"count": 2
},
"statusCode": 200,
"message": "request was successful",
"result": true
}