# 邮件模版
开发者利用模板, 可以方便的为不同用户批量发送相似内容.
通过 API 可以对邮件模板进行查询, 添加, 删除, 修改操作.
# 查询 ( 批量查询 )
返回邮件模板的基本信息
URL
https://api2.sendcloud.net/api/template/list
1
HTTP请求方式
post get
1
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
apiUser | string | 是 | API_USER |
apiKey | string | 是 | API_KEY |
invokeName | string | 否 | 邮件模板调用名称 |
templateType | int | 否 | 邮件模板类型: 0(触发), 1(批量) |
start | int | 否 | 查询起始位置, 取值区间 [0-], 默认为 0 |
limit | int | 否 | 查询个数, 取值区间 [0-100], 默认为 100 |
请求示例
https://api2.sendcloud.net/api/template/list?apiUser=***&apiKey=***&start=0&limit=3
1
返回值说明
参数 | 说明 |
---|---|
name | 邮件模板名称 |
invokeName | 邮件模板调用名称 |
templateType | 模板类型 |
gmtCreated | 邮件模板创建时间 |
gmtModified | 邮件模板修改时间 |
返回值示例
{
"info": {
"dataList": [
{
"name": "ifaxin bill",
"invokeName": "***",
"templateType": 1,
"gmtCreated": "2013-11-21 16:37:41",
"gmtUpdated": "2015-06-12 19:44:07"
},
{
"name": "ifaxin retrieve password",
"invokeName": "***",
"templateType": 0,
"gmtCreated": "2013-11-21 16:39:53",
"gmtUpdated": "2013-11-21 16:39:53"
}
],
"total": 42,
"count": 2
},
"statusCode": 200,
"message": "request was successful",
"result": true
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 查询
返回邮件模板的详细信息
URL
https://api2.sendcloud.net/api/template/get
1
HTTP请求方式
post get
1
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
apiUser | string | 是 | API_USER |
apiKey | string | 是 | API_KEY |
invokeName | string | 是 | 邮件模板调用名称 |
请求示例
https://api2.sendcloud.net/api/template/get?apiUser=***&apiKey=***&invokeName=test
1
返回值说明
参数 | 说明 |
---|---|
name | 邮件模板名称 |
invokeName | 邮件模板调用名称 |
templateType | 模板类型 |
gmtCreated | 邮件模板创建时间 |
gmtModified | 邮件模板修改时间 |
html | 模板内容 |
contentSummary | 邮件摘要 |
subject | 模板标题 |
返回值示例
{
"statusCode": 200,
"info": {
"data": {
"name": "SendCloud",
"invokeName": "15_invoke_2",
"templateType": 0,
"gmtCreated": "2015-02-02 17:01:43",
"gmtUpdated": "2015-04-16 15:04:12",
"html": "<p>Wonderful! You’ve successfully sent the first testing email through SendCloud. Next, please log in to complete your account information.</p>\n",
"subject": "来自SendCloud的第一封邮件!",
"contentSummary":"shesh"
}
},
"message": "request was successful",
"result": true
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 添加
URL
https://api2.sendcloud.net/api/template/add
1
HTTP请求方式
post get
1
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
apiUser | string | 是 | API_USER |
apiKey | string | 是 | API_KEY |
invokeName | string | 是 | 邮件模板调用名称 |
name | string | 是 | 邮件模板名称 |
html | string | 是 | html格式内容 |
text | string | 否 | text格式内容 |
subject | string | 是 | 模板标题 |
templateType | int | 是 | 邮件模板类型: 0(触发), 1(批量) |
提示:
- html 内容中可以使用变量
- html 内容过长或有特殊字符应使用 post 请求
- 模板个数最多为 1000 个
请求示例
curl -d 'apiUser=***&apiKey=***&invokeName=testtemplate&name=test&html=<p>add new template</p>&subject=test_subject&templateType=1' http://api2.sendcloud.net/api/template/add
1
返回值说明
参数 | 说明 |
---|---|
name | 邮件模板名称 |
invokeName | 邮件模板调用名称 |
templateType | 模板类型 |
gmtCreated | 邮件模板创建时间 |
gmtModified | 邮件模板修改时间 |
html | 模板内容 |
subject | 模板标题 |
返回值示例
{
"statusCode": 200,
"info": {
"data": {
"name": "test",
"invokeName": "testtemplate",
"templateType": 0,
"gmtCreated": "2015-10-16 10:42:01",
"gmtUpdated": "",
"html": "<p>add new template</p>",
"subject": "test_subject"
}
},
"message": "request was successful",
"result": true
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 删除
URL
https://api2.sendcloud.net/api/template/delete
1
HTTP请求方式
post get
1
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
apiUser | string | 是 | API_USER |
apiKey | string | 是 | API_KEY |
invokeName | string | 是 | 邮件模板调用名称 |
请求示例
curl http://api2.sendcloud.net/api/template/delete?apiUser=***&apiKey=***&invokeName=test
1
返回值说明
参数 | 说明 |
---|---|
count | 成功删除的邮件模板个数 |
返回值示例
{
"statusCode": 200,
"message": "request was successful",
"result": true,
"info": {
"count": 1
}
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
# 修改
用于修改模板的名称, 内容, 主题, 模板类型
URL
https://api2.sendcloud.net/api/template/update
1
HTTP请求方式
post get
1
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
apiUser | string | 是 | API_USER |
apiKey | string | 是 | API_KEY |
invokeName | string | 是 | 邮件模板调用名称 |
name | string | 否 | 邮件模板名称 |
html | string | 否 | html格式内容 |
subject | string | 否 | 模板标题 |
templateType | int | 否 | 邮件模板类型: 0(触发), 1(批量) |
提示:
- html 内容中可以使用变量
- html 内容过长或有特殊字符应使用 post 请求
请求示例
curl -d 'apiUser=***&apiKey=***&invokeName=testtemplate&name=test&html=<p>update template</p>&subject=test&templateType=1' http://api2.sendcloud.net/api/template/update
1
返回值说明
参数 | 说明 |
---|---|
count | 成功修改的模板个数 |
返回值示例
{
"statusCode": 200,
"message": "request was successful",
"result": true,
"info": {
"count": 1
}
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8