通知服务相关接口
创建主题(CreateSNSTopic)
API请求
URLs
POST zstack/v1/sns/topicsHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "api topic"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"api topic"}}' \
http://localhost:8080/zstack/v1/sns/topics参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| name | String | body(包含在params结构中) | 资源名称 | 2.3 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 2.3 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 2.3 | ||
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 |
API返回
返回示例
{
"inventory": {
"uuid": "a3a307316bb543e786b6dcac39847642",
"name": "new name",
"state": "Enabled",
"createDate": "Feb 28, 2018 9:46:35 AM",
"lastOpDate": "Feb 28, 2018 9:46:35 AM"
}
}#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3 |
| name | String | 资源名称 | 2.3 |
| description | String | 资源的详细描述 | 2.3 |
| state | String | 状态 | 2.3 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3 |
| createDate | Timestamp | 创建时间 | 2.3 |
SDK示例
Java
SDK
CreateSNSTopicAction action = new CreateSNSTopicAction();
action.name = "api topic";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSNSTopicAction.Result res = action.call();Python
SDK
CreateSNSTopicAction action = CreateSNSTopicAction()
action.name = "api topic"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSNSTopicAction.Result res = action.call()删除主题(DeleteSNSTopic)
API请求
URLs
DELETE zstack/v1/sns/topics/{uuid}?deleteMode={deleteMode}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/sns/topics/2e5e362e1a7836618d6cce49fba21e78?deleteMode=Permissive参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 2.3 | |
| deleteMode (可选) | String | url | 2.3 | ||
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
DeleteSNSTopicAction action = new DeleteSNSTopicAction();
action.uuid = "2e5e362e1a7836618d6cce49fba21e78";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteSNSTopicAction.Result res = action.call();Python
SDK
DeleteSNSTopicAction action = DeleteSNSTopicAction()
action.uuid = "2e5e362e1a7836618d6cce49fba21e78"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteSNSTopicAction.Result res = action.call()更改主题状态(ChangeSNSTopicState)
API请求
URLs
PUT zstack/v1/zwatch/topics/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"changeSNSTopicState": {
"stateEvent": "disable"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeSNSTopicState":{"stateEvent":"disable"}}' \
http://localhost:8080/zstack/v1/zwatch/topics/89f0adcff110385a8a8fa2568a744ab5/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 2.3 | |
| stateEvent | String | body(包含在changeSNSTopicState结构中) | 状态事件 |
|
2.3 |
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 |
API返回
返回示例
{
"inventory": {
"uuid": "00f71b1cd92144d68d2f7d0aa3e2e77a",
"name": "new name",
"state": "Enabled",
"createDate": "Feb 28, 2018 9:47:02 AM",
"lastOpDate": "Feb 28, 2018 9:47:02 AM"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.3 |
| inventory | SNSTopicInventory | 详情参考inventory | 2.3 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3 |
| name | String | 资源名称 | 2.3 |
| description | String | 资源的详细描述 | 2.3 |
| state | String | 状态 | 2.3 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3 |
| createDate | Timestamp | 创建时间 | 2.3 |
SDK示例
Java
SDK
ChangeSNSTopicStateAction action = new ChangeSNSTopicStateAction();
action.uuid = "89f0adcff110385a8a8fa2568a744ab5";
action.stateEvent = "disable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeSNSTopicStateAction.Result res = action.call();Python
SDK
ChangeSNSTopicStateAction action = ChangeSNSTopicStateAction()
action.uuid = "89f0adcff110385a8a8fa2568a744ab5"
action.stateEvent = "disable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeSNSTopicStateAction.Result res = action.call()更新主题(UpdateSNSTopic)
API请求
URLs
PUT zstack/v1/sns/topics/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"updateSNSTopic": {
"name": "new name"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateSNSTopic":{"name":"new name"}}' \
http://localhost:8080/zstack/v1/sns/topics/3e7550bf8ead3f02b366df6e499dc285/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 2.3 | |
| name (可选) | String | body(包含在updateSNSTopic结构中) | 资源名称 | 2.3 | |
| description (可选) | String | body(包含在updateSNSTopic结构中) | 资源的详细描述 | 2.3 | |
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 应用标签 | 2.3 |
API返回
返回示例
{
"inventory": {
"uuid": "c3c748d9e08e4e61a03228ca0e6f2eef",
"name": "new name",
"state": "Enabled",
"createDate": "Feb 28, 2018 9:47:49 AM",
"lastOpDate": "Feb 28, 2018 9:47:49 AM"
}
}#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3 |
| name | String | 资源名称 | 2.3 |
| description | String | 资源的详细描述 | 2.3 |
| state | String | 状态 | 2.3 |
| createDate | Timestamp | 创建时间 | 2.3 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3 |
SDK示例
Java
SDK
UpdateSNSTopicAction action = new UpdateSNSTopicAction();
action.uuid = "3e7550bf8ead3f02b366df6e499dc285";
action.name = "new name";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateSNSTopicAction.Result res = action.call();Python
SDK
UpdateSNSTopicAction action = UpdateSNSTopicAction()
action.uuid = "3e7550bf8ead3f02b366df6e499dc285"
action.name = "new name"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateSNSTopicAction.Result res = action.call()查询主题(QuerySNSTopic)
API请求
URLs
GET zstack/v1/sns/topics
GET zstack/v1/sns/topics/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/topics?q=name=apicurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/topics/b47d348c8c4a3559af1b09f31f7c26eb可查询字段
运行CLI命令行工具,输入QuerySNSTopic并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"uuid": "ccbec7ca092e40e0bfdfbd98563cb6da",
"name": "new name",
"state": "Enabled",
"createDate": "Feb 28, 2018 9:47:31 AM",
"lastOpDate": "Feb 28, 2018 9:47:31 AM"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.3 |
| inventories | List | 详情参考inventories | 2.3 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3 |
| name | String | 资源名称 | 2.3 |
| description | String | 资源的详细描述 | 2.3 |
| state | String | 状态 | 2.3 |
| createDate | Timestamp | 创建时间 | 2.3 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3 |
SDK示例
Java
SDK
QuerySNSTopicAction action = new QuerySNSTopicAction();
action.conditions = asList("name=api");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySNSTopicAction.Result res = action.call();Python
SDK
QuerySNSTopicAction action = QuerySNSTopicAction()
action.conditions = ["name=api"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySNSTopicAction.Result res = action.call()创建邮件服务器(CreateSNSEmailPlatform)
API请求
URLs
POST zstack/v1/sns/application-platforms/emailHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"smtpServer": "email.zstack.io",
"smtpPort": 20.0,
"username": "example@cloud.io",
"password": "password",
"encryptType": "STARTTLS",
"name": "email platform"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"smtpServer":"email.zstack.io","smtpPort":20.0,"username":"example@cloud.io",
"password":"password","encryptType":"STARTTLS","name":"email platform"}}' \
http://localhost:8080/zstack/v1/sns/application-platforms/email参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| smtpServer | String | body(包含在params结构中) | SMTP服务器地址 | 2.3 | |
| smtpPort | Integer | body(包含在params结构中) | SMTP端口 | 2.3 | |
| username | String | body(包含在params结构中) | 用户名 | 4.1.0 | |
| password (可选) | String | body(包含在params结构中) | 密码 | 2.3 | |
| name | String | body(包含在params结构中) | 资源名称 | 2.3 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 2.3 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 2.3 | ||
| encryptType (可选) | String | body(包含在params结构中) |
|
2.3 | |
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 |
Note:
- 添加邮箱服务器时,系统会自动检测用户名、密码、邮箱服务器地址、邮箱服务器端口、加密类型是否正确,等待时间不超过5秒。
API返回
返回示例
{
"inventory": {
"uuid": "f6122105d8994b498e6184efcf03bb64",
"name": "email platform",
"description": "example description",
"state": "Enabled",
"type": "Email",
"createDate": "Feb 28, 2018 9:47:35 AM",
"lastOpDate": "Feb 28, 2018 9:47:35 AM"
}
}#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3 |
| name | String | 资源名称 | 2.3 |
| description | String | 资源的详细描述 | 2.3 |
| type | String | 类型 | 2.3 |
| createDate | Timestamp | 创建时间 | 2.3 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3 |
SDK示例
Java
SDK
CreateSNSEmailPlatformAction action = new CreateSNSEmailPlatformAction();
action.smtpServer = "email.zstack.io";
action.smtpPort = 20.0;
action.username = "example@cloud.io";
action.password = "password";
action.encryptType = "STARTTLS";
action.name = "email platform";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSNSEmailPlatformAction.Result res = action.call();Python
SDK
CreateSNSEmailPlatformAction action = CreateSNSEmailPlatformAction()
action.smtpServer = "email.zstack.io"
action.smtpPort = 20.0
action.username = "example@cloud.io"
action.password = "password"
action.encryptType = "STARTTLS"
action.name = "email platform"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSNSEmailPlatformAction.Result res = action.call()测试邮件服务器(ValidateSNSEmailPlatform)
API请求
URLs
PUT zstack/v1/sns/application-platforms/email/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"validateSNSEmailPlatform": {},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"validateSNSEmailPlatform":{}}' \
http://localhost:8080/zstack/v1/sns/application-platforms/email/ee6f4b67dc7e3b298353a6fe2b5d0a6f/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 2.3 | |
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
ValidateSNSEmailPlatformAction action = new ValidateSNSEmailPlatformAction();
action.uuid = "ee6f4b67dc7e3b298353a6fe2b5d0a6f";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ValidateSNSEmailPlatformAction.Result res = action.call();Python
SDK
ValidateSNSEmailPlatformAction action = ValidateSNSEmailPlatformAction()
action.uuid = "ee6f4b67dc7e3b298353a6fe2b5d0a6f"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ValidateSNSEmailPlatformAction.Result res = action.call()删除SNS应用平台(DeleteSNSApplicationPlatform)
API请求
URLs
DELETE zstack/v1/sns/application-platforms/{uuid}?deleteMode={deleteMode}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/sns/application-platforms/992bf9e24f6f3f25866956f8079ffadc?deleteMode=Permissive参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 2.3 | |
| deleteMode (可选) | String | url | 2.3 | ||
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
DeleteSNSApplicationPlatformAction action = new DeleteSNSApplicationPlatformAction();
action.uuid = "992bf9e24f6f3f25866956f8079ffadc";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteSNSApplicationPlatformAction.Result res = action.call();Python
SDK
DeleteSNSApplicationPlatformAction action = DeleteSNSApplicationPlatformAction()
action.uuid = "992bf9e24f6f3f25866956f8079ffadc"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteSNSApplicationPlatformAction.Result res = action.call()查询邮件服务器(QuerySNSEmailPlatform)
API请求
URLs
GET zstack/v1/sns/application-platforms/email
GET zstack/v1/sns/application-platforms/email/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-platforms/email?q=name=emailcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-platforms/email/fe6d6cd0fbf53a4eaa772f326972d765可查询字段
运行CLI命令行工具,输入QuerySNSEmailPlatform并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
QuerySNSEmailPlatformAction action = new QuerySNSEmailPlatformAction();
action.conditions = asList("name=email");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySNSEmailPlatformAction.Result res = action.call();Python
SDK
QuerySNSEmailPlatformAction action = QuerySNSEmailPlatformAction()
action.conditions = ["name=email"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySNSEmailPlatformAction.Result res = action.call()更新SNS应用平台(UpdateSNSApplicationPlatform)
API请求
URLs
PUT zstack/v1/sns/application-platforms/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"updateSNSApplicationPlatform": {
"name": "new name"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateSNSApplicationPlatform":{"name":"new name"}}' \
http://localhost:8080/zstack/v1/sns/application-platforms/577aff1dcbe932798fd615e88813c7ce/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 2.3 | |
| name (可选) | String | body(包含在updateSNSApplicationPlatform结构中) | 资源名称 | 2.3 | |
| description (可选) | String | body(包含在updateSNSApplicationPlatform结构中) | 资源的详细描述 | 2.3 | |
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 应用标签 | 2.3 |
API返回
返回示例
{
"inventory": {
"uuid": "f0f61510039d48709f4bb7804588bb4f",
"name": "email platform",
"description": "example description",
"state": "Enabled",
"type": "Email",
"createDate": "Feb 28, 2018 9:47:13 AM",
"lastOpDate": "Feb 28, 2018 9:47:13 AM"
}
}#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3 |
| name | String | 资源名称 | 2.3 |
| description | String | 资源的详细描述 | 2.3 |
| type | String | 类型 | 2.3 |
| createDate | Timestamp | 创建时间 | 2.3 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3 |
SDK示例
Java
SDK
UpdateSNSApplicationPlatformAction action = new UpdateSNSApplicationPlatformAction();
action.uuid = "577aff1dcbe932798fd615e88813c7ce";
action.name = "new name";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateSNSApplicationPlatformAction.Result res = action.call();Python
SDK
UpdateSNSApplicationPlatformAction action = UpdateSNSApplicationPlatformAction()
action.uuid = "577aff1dcbe932798fd615e88813c7ce"
action.name = "new name"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateSNSApplicationPlatformAction.Result res = action.call()查询SNS应用平台(QuerySNSApplicationPlatform)
API请求
URLs
GET zstack/v1/sns/application-platforms
GET zstack/v1/sns/application-platforms/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-platforms?q=state=Enabledcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-platforms/b9a635c9ff7c3544a232cad5b9a4aaf7可查询字段
运行CLI命令行工具,输入QuerySNSApplicationPlatform并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"uuid": "c418160d00ff407986dde8bd10a7f0c4",
"name": "email platform",
"description": "example description",
"state": "Enabled",
"type": "Email",
"createDate": "Feb 28, 2018 9:46:58 AM",
"lastOpDate": "Feb 28, 2018 9:46:58 AM"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.3 |
| inventories | List | 详情参考inventories | 2.3 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3 |
| name | String | 资源名称 | 2.3 |
| description | String | 资源的详细描述 | 2.3 |
| type | String | 类型 | 2.3 |
| createDate | Timestamp | 创建时间 | 2.3 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3 |
SDK示例
Java
SDK
QuerySNSApplicationPlatformAction action = new QuerySNSApplicationPlatformAction();
action.conditions = asList("state=Enabled");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySNSApplicationPlatformAction.Result res = action.call();Python
SDK
QuerySNSApplicationPlatformAction action = QuerySNSApplicationPlatformAction()
action.conditions = ["state=Enabled"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySNSApplicationPlatformAction.Result res = action.call()更改SNS应用平台状态(ChangeSNSApplicationPlatformState)
API请求
URLs
PUT zstack/v1/sns/application-platforms/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"changeSNSApplicationPlatformState": {
"stateEvent": "enable"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeSNSApplicationPlatformState":{"stateEvent":"enable"}}' \
http://localhost:8080/zstack/v1/sns/application-platforms/bf16a9b0315a3942afb8b7f29e1287eb/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 2.3 | |
| stateEvent | String | body(包含在changeSNSApplicationPlatformState结构中) | 状态事件 |
|
2.3 |
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 |
API返回
返回示例
{
"inventory": {
"uuid": "cce6611ab37f4e16b4e95a08d31838b1",
"name": "email platform",
"description": "example description",
"state": "Enabled",
"type": "Email",
"createDate": "Feb 28, 2018 9:45:19 AM",
"lastOpDate": "Feb 28, 2018 9:45:19 AM"
}
}#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3 |
| name | String | 资源名称 | 2.3 |
| description | String | 资源的详细描述 | 2.3 |
| type | String | 类型 | 2.3 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3 |
| createDate | Timestamp | 创建时间 | 2.3 |
SDK示例
Java
SDK
ChangeSNSApplicationPlatformStateAction action = new ChangeSNSApplicationPlatformStateAction();
action.uuid = "bf16a9b0315a3942afb8b7f29e1287eb";
action.stateEvent = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeSNSApplicationPlatformStateAction.Result res = action.call();Python
SDK
ChangeSNSApplicationPlatformStateAction action = ChangeSNSApplicationPlatformStateAction()
action.uuid = "bf16a9b0315a3942afb8b7f29e1287eb"
action.stateEvent = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeSNSApplicationPlatformStateAction.Result res = action.call()创建邮件接收端(CreateSNSEmailEndpoint)
API请求
URLs
POST zstack/v1/sns/application-endpoints/emailsHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"email": "example@cloud.io",
"emails": [
"example@cloud.io"
],
"name": "email",
"platformUuid": "5efc525948a537e39a91290c57d6d37b"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"email":"example@cloud.io","emails":["example@cloud.io"],"name":"email","platformUuid":"5efc525948a537e39a91290c57d6d37b"}}' http://localhost:8080/zstack/v1/sns/application-endpoints/emails参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| String | body | email地址 | 2.3.0 | ||
| emails (可选) | List | body(包含在params结构中) | 3.7.0 | ||
| name | String | body | 资源名称 | 2.3.0 | |
| description (可选) | String | body | 资源的详细描述 | 2.3.0 | |
| platformUuid (可选) | String | body | 应用平台UUID | 2.3.0 | |
| resourceUuid (可选) | String | body | 2.3.0 | ||
| tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 3.7.0 | |
| systemTags (可选) | List | body | 系统标签 | 2.3.0 | |
| userTags (可选) | List | body | 用户标签 | 2.3.0 |
API返回
返回示例
{
"inventory": {
"name": "example",
"uuid": "917fe66f76b241f0843dfbd6be685fc1",
"description": "description example",
"type": "Email",
"state": "Enabled",
"platformUuid": "4eb0ceebf95b452585ebeacd647d9f35",
"createDate": "Sep 6, 2019 2:52:41 PM",
"lastOpDate": "Sep 6, 2019 2:52:41 PM"
}
}#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3 |
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3 |
| description | String | 资源的详细描述 | 2.3 |
| type | String | 类型 | 2.3 |
| state | String | 2.3 | |
| platformUuid | String | 应用平台UUID | 2.3 |
| createDate | Timestamp | 创建时间 | 2.3 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3 |
SDK示例
Java
SDK
CreateSNSEmailEndpointAction action = new CreateSNSEmailEndpointAction();
action.email = "example@cloud.io";
action.emails = asList("example@cloud.io");
action.name = "email";
action.platformUuid = "5efc525948a537e39a91290c57d6d37b";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSNSEmailEndpointAction.Result res = action.call();Python
SDK
CreateSNSEmailEndpointAction action = CreateSNSEmailEndpointAction()
action.email = "example@cloud.io"
action.emails = [example@cloud.io]
action.name = "email"
action.platformUuid = "5efc525948a537e39a91290c57d6d37b"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSNSEmailEndpointAction.Result res = action.call()查询邮件接收端(QuerySNSEmailEndpoint)
API请求
URLs
GET zstack/v1/sns/application-endpoints/emails
GET zstack/v1/sns/application-endpoints/emails/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-endpoints/emails?q=email=test@cloud.iocurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-endpoints/emails/bbae379b811f3d18a422d73557ece1b1可查询字段
运行CLI命令行工具,输入QuerySNSEmailEndpoint并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
QuerySNSEmailEndpointAction action = new QuerySNSEmailEndpointAction();
action.conditions = asList("email=test@cloud.io");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySNSEmailEndpointAction.Result res = action.call();Python
SDK
QuerySNSEmailEndpointAction action = QuerySNSEmailEndpointAction()
action.conditions = ["email=test@cloud.io"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySNSEmailEndpointAction.Result res = action.call()创建HTTP接收端(CreateSNSHttpEndpoint)
API请求
URLs
POST zstack/v1/sns/application-endpoints/httpHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"url": "http://127.0.0.1:6666/test-url",
"username": "username",
"password": "password",
"name": "http"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"url":"http://127.0.0.1:6666/test-url","username":"username","password":"password","name":"http"}}' \
http://localhost:8080/zstack/v1/sns/application-endpoints/http参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| url | String | body(包含在params结构中) | HTTP URL | 2.3 | |
| username (可选) | String | body(包含在params结构中) | 用户名 | 2.3 | |
| password (可选) | String | body(包含在params结构中) | 密码 | 2.3 | |
| name | String | body(包含在params结构中) | 资源名称 | 2.3 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 2.3 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 2.3 | ||
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 | |
| platformUuid (可选) | String | body(包含在params结构中) | 0.6 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
CreateSNSHttpEndpointAction action = new CreateSNSHttpEndpointAction();
action.url = "http://127.0.0.1:6666/test-url";
action.username = "username";
action.password = "password";
action.name = "http";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSNSHttpEndpointAction.Result res = action.call();Python
SDK
CreateSNSHttpEndpointAction action = CreateSNSHttpEndpointAction()
action.url = "http://127.0.0.1:6666/test-url"
action.username = "username"
action.password = "password"
action.name = "http"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSNSHttpEndpointAction.Result res = action.call()查询HTTP接收端(QuerySNSHttpEndpoint)
API请求
URLs
GET zstack/v1/sns/application-endpoints/http
GET zstack/v1/sns/application-endpoints/http/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-endpoints/http?q=url=http://urlcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-endpoints/http/cbd9163bb4683e10b8a5025621e36862可查询字段
运行CLI命令行工具,输入QuerySNSHttpEndpoint并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
QuerySNSHttpEndpointAction action = new QuerySNSHttpEndpointAction();
action.conditions = asList("url=http://url");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySNSHttpEndpointAction.Result res = action.call();Python
SDK
QuerySNSHttpEndpointAction action = QuerySNSHttpEndpointAction()
action.conditions = ["url=http://url"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySNSHttpEndpointAction.Result res = action.call()创建钉钉接收端(CreateSNSDingTalkEndpoint)
API请求
URLs
POST zstack/v1/sns/application-endpoints/ding-talkHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"url": "http://dingding-robot-url",
"atAll": false,
"atPersonPhoneNumbers": [
"18900002222",
"13377778888"
],
"name": "dinding"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"url":"http://dingding-robot-url","atAll":false,"atPersonPhoneNumbers":["18900002222","13377778888"],"name":"dinding"}}' \
http://localhost:8080/zstack/v1/sns/application-endpoints/ding-talk参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| url | String | body(包含在params结构中) | 钉钉机器人URL | 2.3 | |
| atAll (可选) | Boolean | body(包含在params结构中) | 是否消息@所有人 | 2.3 | |
| atPersonPhoneNumbers (可选) | List | body(包含在params结构中) | 要@用户的电话号码 | 2.3 | |
| name | String | body(包含在params结构中) | 资源名称 | 2.3 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 2.3 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 2.3 | ||
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 | |
| platformUuid (可选) | String | body(包含在params结构中) | 2.3 |
API返回
返回示例
{
"inventory": {
"url": "http://dingding-url",
"atAll": false,
"atPersonPhoneNumbers": [
"18900001111"
],
"name": "example",
"uuid": "917fe66f76b241f0843dfbd6be685fc1",
"description": "description example",
"type": "Email",
"platformUuid": "4eb0ceebf95b452585ebeacd647d9f35",
"createDate": "Feb 28, 2018 9:47:10 AM",
"lastOpDate": "Feb 28, 2018 9:47:10 AM"
}
}#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| url | String | 钉钉机器人URL | 2.3 |
| atAll | boolean | 是否@所有人 | 2.3 |
| atPersonPhoneNumbers | List | @用户的电话号码 | 2.3 |
| name | String | 资源名称 | 2.3 |
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3 |
| description | String | 资源的详细描述 | 2.3 |
| type | String | 终端类型 | 2.3 |
| platformUuid | String | 应用平台UUID | 2.3 |
| createDate | Timestamp | 创建时间 | 2.3 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3 |
SDK示例
Java
SDK
CreateSNSDingTalkEndpointAction action = new CreateSNSDingTalkEndpointAction();
action.url = "http://dingding-robot-url";
action.atAll = false;
action.atPersonPhoneNumbers = asList("18900002222","13377778888");
action.name = "dinding";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSNSDingTalkEndpointAction.Result res = action.call();Python
SDK
CreateSNSDingTalkEndpointAction action = CreateSNSDingTalkEndpointAction()
action.url = "http://dingding-robot-url"
action.atAll = false
action.atPersonPhoneNumbers = [18900002222, 13377778888]
action.name = "dinding"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSNSDingTalkEndpointAction.Result res = action.call()添加钉钉用户(AddSNSDingTalkAtPerson)
API请求
URLs
POST zstack/v1/sns/application-endpoints/ding-talk/at-personsHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"phoneNumber": "18099997777",
"endpointUuid": "5b9b95ca0cda3ab4bb51b5a4e1965305"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"phoneNumber":"18099997777","endpointUuid":"5b9b95ca0cda3ab4bb51b5a4e1965305"}}' \
http://localhost:8080/zstack/v1/sns/application-endpoints/ding-talk/at-persons参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| phoneNumber | String | body(包含在params结构中) | 用户电话号码(钉钉用户以电话注册) | 2.3 | |
| endpointUuid | String | body(包含在params结构中) | 钉钉终端UUID | 2.3 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 2.3 | ||
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 |
API返回
返回示例
{
"inventory": {
"uuid": "a72aa83b023744828f52adf83d850ed7",
"phoneNumber": "18988887777",
"endpointUuid": "ad5dc331264c4bcbbe56ee2523cde7a2"
}
}#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3 |
| phoneNumber | String | 用户电话号码 | 2.3 |
| endpointUuid | String | 钉钉终端UUID | 2.3 |
SDK示例
Java
SDK
AddSNSDingTalkAtPersonAction action = new AddSNSDingTalkAtPersonAction();
action.phoneNumber = "18099997777";
action.endpointUuid = "5b9b95ca0cda3ab4bb51b5a4e1965305";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddSNSDingTalkAtPersonAction.Result res = action.call();Python
SDK
AddSNSDingTalkAtPersonAction action = AddSNSDingTalkAtPersonAction()
action.phoneNumber = "18099997777"
action.endpointUuid = "5b9b95ca0cda3ab4bb51b5a4e1965305"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddSNSDingTalkAtPersonAction.Result res = action.call()删除钉钉用户(RemoveSNSDingTalkAtPerson)
API请求
URLs
DELETE zstack/v1/sns/application-endpoints/ding-talk/{endpointUuid}/at-persons/{phoneNumber}?deleteMode={deleteMode}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/sns/application-endpoints/ding-talk/696e69a1023f323ca147be82ed7f13cd/at-persons/18988887777?deleteMode=Permissive参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| deleteMode (可选) | String | url | 2.3 | ||
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 | |
| endpointUuid | String | url | 钉钉接收端UUID | 2.3 | |
| phoneNumber | String | url | 要删除的atPerson的电话 | 2.3 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
RemoveSNSDingTalkAtPersonAction action = new RemoveSNSDingTalkAtPersonAction();
action.endpointUuid = "696e69a1023f323ca147be82ed7f13cd";
action.phoneNumber = "18988887777";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveSNSDingTalkAtPersonAction.Result res = action.call();Python
SDK
RemoveSNSDingTalkAtPersonAction action = RemoveSNSDingTalkAtPersonAction()
action.endpointUuid = "696e69a1023f323ca147be82ed7f13cd"
action.phoneNumber = "18988887777"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveSNSDingTalkAtPersonAction.Result res = action.call()查询钉钉终端(QuerySNSDingTalkEndpoint)
API请求
URLs
GET zstack/v1/sns/application-endpoints/ding-talk
GET zstack/v1/sns/application-endpoints/ding-talk/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-endpoints/ding-talk?q=url=http://dingding-urlcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-endpoints/ding-talk/69658f91a1f130e0986fbfb19de1b3c9可查询字段
运行CLI命令行工具,输入QuerySNSDingTalkEndpoint并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
QuerySNSDingTalkEndpointAction action = new QuerySNSDingTalkEndpointAction();
action.conditions = asList("url=http://dingding-url");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySNSDingTalkEndpointAction.Result res = action.call();Python
SDK
QuerySNSDingTalkEndpointAction action = QuerySNSDingTalkEndpointAction()
action.conditions = ["url=http://dingding-url"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySNSDingTalkEndpointAction.Result res = action.call()删除接收端(DeleteSNSApplicationEndpoint)
API请求
URLs
DELETE zstack/v1/sns/application-endpoints/{uuid}?deleteMode={deleteMode}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/sns/application-endpoints/f068da2f92f7354cbc9054a6c14989ea?deleteMode=Permissive参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 2.3 | |
| deleteMode (可选) | String | body | 2.3 | ||
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
DeleteSNSApplicationEndpointAction action = new DeleteSNSApplicationEndpointAction();
action.uuid = "f068da2f92f7354cbc9054a6c14989ea";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteSNSApplicationEndpointAction.Result res = action.call();Python
SDK
DeleteSNSApplicationEndpointAction action = DeleteSNSApplicationEndpointAction()
action.uuid = "f068da2f92f7354cbc9054a6c14989ea"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteSNSApplicationEndpointAction.Result res = action.call()更新接收端(UpdateSNSApplicationEndpoint)
API请求
URLs
PUT zstack/v1/sns/application-endpoints/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"updateSNSApplicationEndpoint": {
"name": "new name"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateSNSApplicationEndpoint":{"name":"new name"}}' \
http://localhost:8080/zstack/v1/sns/application-endpoints/7d6155384f4e3cdaa6e877ecec59318c/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 2.3 | |
| name (可选) | String | body(包含在updateSNSApplicationEndpoint结构中) | 资源名称 | 2.3 | |
| description (可选) | String | body(包含在updateSNSApplicationEndpoint结构中) | 资源的详细描述 | 2.3 | |
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 |
API返回
返回示例
{
"inventory": {
"name": "example",
"uuid": "917fe66f76b241f0843dfbd6be685fc1",
"description": "description example",
"type": "Email",
"state": "Enabled",
"platformUuid": "4eb0ceebf95b452585ebeacd647d9f35",
"createDate": "Feb 28, 2018 9:46:19 AM",
"lastOpDate": "Feb 28, 2018 9:46:19 AM"
}
}#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| name | String | 资源名称 | 2.3 |
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3 |
| description | String | 资源的详细描述 | 2.3 |
| type | String | 类型 | 2.3 |
| platformUuid | String | 应用平台UUID | 2.3 |
| createDate | Timestamp | 创建时间 | 2.3 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3 |
SDK示例
Java
SDK
UpdateSNSApplicationEndpointAction action = new UpdateSNSApplicationEndpointAction();
action.uuid = "7d6155384f4e3cdaa6e877ecec59318c";
action.name = "new name";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateSNSApplicationEndpointAction.Result res = action.call();Python
SDK
UpdateSNSApplicationEndpointAction action = UpdateSNSApplicationEndpointAction()
action.uuid = "7d6155384f4e3cdaa6e877ecec59318c"
action.name = "new name"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateSNSApplicationEndpointAction.Result res = action.call()查询接收端(QuerySNSApplicationEndpoint)
API请求
URLs
GET zstack/v1/sns/application-endpoints
GET zstack/v1/sns/application-endpoints/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-endpoints?q=name=httpcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-endpoints/b8a4be12db8237a1a42f897402afd4e8可查询字段
运行CLI命令行工具,输入QuerySNSApplicationEndpoint并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
QuerySNSApplicationEndpointAction action = new QuerySNSApplicationEndpointAction();
action.conditions = asList("name=http");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySNSApplicationEndpointAction.Result res = action.call();Python
SDK
QuerySNSApplicationEndpointAction action = QuerySNSApplicationEndpointAction()
action.conditions = ["name=http"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySNSApplicationEndpointAction.Result res = action.call()更改接收端(ChangeSNSApplicationEndpointState)
API请求
URLs
PUT zstack/v1/sns/application-endpoints/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"changeSNSApplicationEndpointState": {
"stateEvent": "disable"
},
"systemTags": [],
"userTags": []
}Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeSNSApplicationEndpointState":{"stateEvent":"disable"}}' \
http://localhost:8080/zstack/v1/sns/application-endpoints/1485ef44ea5234ee83d80d3a15937e19/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 2.3 | |
| stateEvent | String | body(包含在changeSNSApplicationEndpointState结构中) | 状态事件 |
|
2.3 |
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 |
API返回
返回示例
{
"inventory": {
"name": "example",
"uuid": "917fe66f76b241f0843dfbd6be685fc1",
"description": "description example",
"type": "Email",
"state": "Enabled",
"platformUuid": "4eb0ceebf95b452585ebeacd647d9f35",
"createDate": "Feb 28, 2018 9:47:32 AM",
"lastOpDate": "Feb 28, 2018 9:47:32 AM"
}
}#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 2.3 |
| name | String | 资源名称 | 2.3 |
| description | String | 资源的详细描述 | 2.3 |
| type | String | 类型 | 2.3 |
| platformUuid | String | 应用平台UUID | 2.3 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3 |
| createDate | Timestamp | 创建时间 | 2.3 |
SDK示例
Java
SDK
ChangeSNSApplicationEndpointStateAction action = new ChangeSNSApplicationEndpointStateAction();
action.uuid = "1485ef44ea5234ee83d80d3a15937e19";
action.stateEvent = "disable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeSNSApplicationEndpointStateAction.Result res = action.call();Python
SDK
ChangeSNSApplicationEndpointStateAction action = ChangeSNSApplicationEndpointStateAction()
action.uuid = "1485ef44ea5234ee83d80d3a15937e19"
action.stateEvent = "disable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeSNSApplicationEndpointStateAction.Result res = action.call()创建阿里云短信接收端(CreateSNSAliyunSmsEndpoint)
API请求
URLs
POST zstack/v1/sns/sms-endpoints/aliyunsmsHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"accessKeyUuid": "4eb00e2bf95bp5s505e6eccd647d9k35",
"receivers": [
"13555555555",
"18666666666"
],
"name": "AliyunSms",
"description": "This is an Aliyun SMS Endpoint"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"accessKeyUuid":"4eb00e2bf95bp5s505e6eccd647d9k35","receivers":["13555555555","18666666666"],"name":"AliyunSms","description":"This is an Aliyun SMS Endpoint"}}' http://localhost:8080/zstack/v1/sns/sms-endpoints/aliyunsms参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| accessKeyUuid | String | body(包含在params结构中) | 阿里云AccessKey信息Uuid | 3.7.0 | |
| receivers (可选) | List | body(包含在params结构中) | 短信接收者 | 3.7.0 | |
| name | String | body(包含在params结构中) | 接收端名称 | 3.7.0 | |
| description (可选) | String | body(包含在params结构中) | 接收端的详细描述 | 3.7.0 | |
| platformUuid (可选) | String | body(包含在params结构中) | 3.7.0 | ||
| resourceUuid (可选) | String | body(包含在params结构中) | 3.7.0 | ||
| tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 3.7.0 | |
| systemTags (可选) | List | body | 系统标签 | 3.7.0 | |
| userTags (可选) | List | body | 用户标签 | 3.7.0 |
API返回
返回示例
{
"inventory": {
"name": "example",
"uuid": "041723a4d9d14e8686dbec7d1369c05e",
"description": "example SNSSmsEndpoint Description",
"type": "AliyunSms",
"state": "Enabled",
"platformUuid": "4eb0ceebf95b452585ebeacd647d9f35",
"createDate": "Oct 8, 2019 5:32:15 PM",
"lastOpDate": "Oct 8, 2019 5:32:15 PM"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 3.7.0 |
| inventory | SNSSmsEndpointInventory | 详情参考inventory | 3.7.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| receivers | List | 短信接收者 | 3.7.0 |
| name | String | 短信接收端名称 | 3.7.0 |
| uuid | String | 短信接收端的UUID,唯一标示该资源 | 3.7.0 |
| description | String | 短信接收端的详细描述 | 3.7.0 |
| type | String | 短信接收端类型 | 3.7.0 |
| state | String | 短信接收端状态 | 3.7.0 |
| platformUuid | String | 3.7.0 | |
| createDate | Timestamp | 创建时间 | 3.7.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 3.7.0 |
SDK示例
Java
SDK
CreateSNSAliyunSmsEndpointAction action = new CreateSNSAliyunSmsEndpointAction();
action.accessKeyUuid = "4eb00e2bf95bp5s505e6eccd647d9k35";
action.receivers = asList("13555555555","18666666666");
action.name = "AliyunSms";
action.description = "This is an Aliyun SMS Endpoint";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSNSAliyunSmsEndpointAction.Result res = action.call();Python
SDK
CreateSNSAliyunSmsEndpointAction action = CreateSNSAliyunSmsEndpointAction()
action.accessKeyUuid = "4eb00e2bf95bp5s505e6eccd647d9k35"
action.receivers = [13555555555, 18666666666]
action.name = "AliyunSms"
action.description = "This is an Aliyun SMS Endpoint"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSNSAliyunSmsEndpointAction.Result res = action.call()验证阿里云短信接收端(ValidateSNSAliyunSmsEndpoint)
API请求
URLs
PUT zstack/v1/sns/sms-endpoints/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"validateSNSAliyunSmsEndpoint": {
"phoneNumbers": [
"134567898765",
"18654321234"
]
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"validateSNSAliyunSmsEndpoint":{"phoneNumbers":["134567898765","18654321234"]}}' http://localhost:8080/zstack/v1/sns/sms-endpoints/56304854f10730adac30a81c1e8e8de4/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 接收端的UUID,唯一标示该资源 | 3.7.0 | |
| phoneNumbers | List | body(包含在validateSNSAliyunSmsEndpoint结构中) | 验证短信接收者 | 3.7.0 | |
| systemTags (可选) | List | body | 系统标签 | 3.7.0 | |
| userTags (可选) | List | body | 用户标签 | 3.7.0 |
API返回
该API成功时返回一个空的JSON结构
{},出错时返回的JSON结构包含一个error字段,例如:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
ValidateSNSAliyunSmsEndpointAction action = new ValidateSNSAliyunSmsEndpointAction();
action.uuid = "56304854f10730adac30a81c1e8e8de4";
action.phoneNumbers = asList("134567898765","18654321234");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ValidateSNSAliyunSmsEndpointAction.Result res = action.call();Python
SDK
ValidateSNSAliyunSmsEndpointAction action = ValidateSNSAliyunSmsEndpointAction()
action.uuid = "56304854f10730adac30a81c1e8e8de4"
action.phoneNumbers = [134567898765, 18654321234]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ValidateSNSAliyunSmsEndpointAction.Result res = action.call()添加短信接收者(AddSNSSmsReceiver)
API请求
URLs
POST zstack/v1/sns/sms-endpoints/receiversHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"phoneNumber": "13333333333",
"endpointUuid": "467e77c4cc42492f9794429e689a9874",
"type": "AliyunSms",
"description": "description"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"phoneNumber":"13333333333","endpointUuid":"467e77c4cc42492f9794429e689a9874","type":"AliyunSms","description":"description"}}' http://localhost:8080/zstack/v1/sns/sms-endpoints/receivers参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| phoneNumber | String | body(包含在params结构中) | 短信接收号码 | 3.7.0 | |
| endpointUuid | String | body(包含在params结构中) | 短信接收端Uuid | 3.7.0 | |
| type | String | body(包含在params结构中) | 短信接收端类型 |
|
3.7.0 |
| description (可选) | String | body(包含在params结构中) | 短信接收者描述 | 3.7.0 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 3.7.0 | ||
| tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 3.7.0 | |
| systemTags (可选) | List | body | 系统标签 | 3.7.0 | |
| userTags (可选) | List | body | 用户标签 | 3.7.0 |
API返回
返回示例
{
"inventory": {
"uuid": "54f2c73bbdd24bd383bc898c94e4e157",
"phoneNumber": "18912345678",
"endpointUuid": "e0a8e9de43774027a486f3a47fa0b46c",
"type": "AliyunSms",
"description": "description",
"createDate": "Oct 11, 2019 2:55:42 PM",
"lastOpDate": "Oct 11, 2019 2:55:42 PM"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 3.7.0 |
| inventory | SNSSmsReceiverInventory | 详情参考inventory | 3.7.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 3.7.0 |
| phoneNumber | String | 短信接收号码 | 3.7.0 |
| endpointUuid | String | 短信接收端Uuid | 3.7.0 |
| description | String | 短信接收者描述 | 3.7.0 |
| createDate | Timestamp | 创建时间 | 3.7.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 3.7.0 |
| type | SmsReceiverType | 详情参考type | 3.7.0 |
#type
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| AliyunSms | SmsReceiverType | 阿里云短信 | 3.7.0 |
SDK示例
Java
SDK
AddSNSSmsReceiverAction action = new AddSNSSmsReceiverAction();
action.phoneNumber = "13333333333";
action.endpointUuid = "467e77c4cc42492f9794429e689a9874";
action.type = "AliyunSms";
action.description = "description";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddSNSSmsReceiverAction.Result res = action.call();Python
SDK
AddSNSSmsReceiverAction action = AddSNSSmsReceiverAction()
action.phoneNumber = "13333333333"
action.endpointUuid = "467e77c4cc42492f9794429e689a9874"
action.type = "AliyunSms"
action.description = "description"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddSNSSmsReceiverAction.Result res = action.call()删除短信接收者(RemoveSNSSmsReceiver)
API请求
URLs
DELETE zstack/v1/sns/sms-endpoints/{endpointUuid}/receivers/{phoneNumber}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/sns/sms-endpoints/196b91815e983d1397cb336a4fc9d054/receivers/18812345678?deleteMode=Permissive
参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| endpointUuid | String | url | 短信接收端Uuid | 3.7.0 | |
| phoneNumber | String | url | 短信接收号码 | 3.7.0 | |
| deleteMode (可选) | String | body | 3.7.0 | ||
| systemTags (可选) | List | body | 系统标签 | 3.7.0 | |
| userTags (可选) | List | body | 用户标签 | 3.7.0 |
API返回
该API成功时返回一个空的JSON结构
{},出错时返回的JSON结构包含一个error字段,例如:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
RemoveSNSSmsReceiverAction action = new RemoveSNSSmsReceiverAction();
action.endpointUuid = "196b91815e983d1397cb336a4fc9d054";
action.phoneNumber = "18812345678";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveSNSSmsReceiverAction.Result res = action.call();Python
SDK
RemoveSNSSmsReceiverAction action = RemoveSNSSmsReceiverAction()
action.endpointUuid = "196b91815e983d1397cb336a4fc9d054"
action.phoneNumber = "18812345678"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveSNSSmsReceiverAction.Result res = action.call()查询短信接收端(QuerySNSSmsEndpoint)
API请求
URLs
GET zstack/v1/sns/sms-endpoints
GET zstack/v1/sns/sms-endpoints/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/sms-endpoints?q=name=SmsEndpointcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/sms-endpoints/5efca3a7d67031fbba5bc512e52a4798可查询字段
运行CLI命令行工具,输入QuerySNSSmsEndpoint并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
该API成功时返回一个空的JSON结构
{},出错时返回的JSON结构包含一个error字段,例如:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
QuerySNSSmsEndpointAction action = new QuerySNSSmsEndpointAction();
action.conditions = asList("name=SmsEndpoint");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySNSSmsEndpointAction.Result res = action.call();Python
SDK
QuerySNSSmsEndpointAction action = QuerySNSSmsEndpointAction()
action.conditions = ["name=SmsEndpoint"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySNSSmsEndpointAction.Result res = action.call()添加邮箱地址到邮箱接收端(AddEmailAddressToSNSEmailEndpoint)
API请求
URLs
POST zstack/v1/sns/application-endpoints/emails/email-addressesHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"emailAddress": "example@cloud.io",
"endpointUuid": "74220bbf0d8b3c6b943a294c2679ca69"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"emailAddress":"example@cloud.io","endpointUuid":"74220bbf0d8b3c6b943a294c2679ca69"}}' http://localhost:8080/zstack/v1/sns/application-endpoints/emails/email-addresses参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| emailAddress | String | body(包含在params结构中) | 邮箱地址 | 3.7.0 | |
| endpointUuid | String | body(包含在params结构中) | 接收端uuid | 3.7.0 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 3.7.0 | ||
| tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 3.7.0 | |
| systemTags (可选) | List | body | 3.7.0 | ||
| userTags (可选) | List | body | 3.7.0 |
API返回
返回示例
{
"inventory": {
"uuid": "f5682eb7abaa4bbe9bfd35b271138e9f",
"emailAddress": "example@cloud.io",
"endpointUuid": "a6bc3b6aa6b749db88a465530ea23f9e"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 3.7.0 |
| inventory | SNSEmailAddressInventory | 详情参考inventory | 3.7.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 3.7.0 |
| description | String | 错误的概要描述 | 3.7.0 |
| details | String | 错误的详细信息 | 3.7.0 |
| elaboration | String | 保留字段,默认为null | 3.7.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 3.7.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 3.7.0 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 3.7.0 |
| emailAddress | String | 3.7.0 | |
| endpointUuid | String | 3.7.0 |
SDK示例
Java
SDK
AddEmailAddressToSNSEmailEndpointAction action = new AddEmailAddressToSNSEmailEndpointAction();
action.emailAddress = "example@cloud.io";
action.endpointUuid = "74220bbf0d8b3c6b943a294c2679ca69";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddEmailAddressToSNSEmailEndpointAction.Result res = action.call();Python
SDK
AddEmailAddressToSNSEmailEndpointAction action = AddEmailAddressToSNSEmailEndpointAction()
action.emailAddress = "example@cloud.io"
action.endpointUuid = "74220bbf0d8b3c6b943a294c2679ca69"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddEmailAddressToSNSEmailEndpointAction.Result res = action.call()更新接收端邮箱地址(UpdateEmailAddressOfSNSEmailEndpoint)
API请求
URLs
PUT zstack/v1/sns/application-endpoints/emails/email-addressesHeaders
Authorization: OAuth the-session-uuidBody
{
"updateEmailAddressOfSNSEmailEndpoint": {
"emailAddressUuid": "cb2b3d85e0da3a299c52c23510ba15dd",
"endpointUuid": "f305528eb6773a73beac3f94f79d3017",
"emailAddress": "example@cloud.io"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateEmailAddressOfSNSEmailEndpoint":{"emailAddressUuid":"cb2b3d85e0da3a299c52c23510ba15dd","endpointUuid":"f305528eb6773a73beac3f94f79d3017","emailAddress":"example@cloud.io"}}' http://localhost:8080/zstack/v1/sns/application-endpoints/emails/email-addresses参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| emailAddressUuid | String | body(包含在updateEmailAddress结构中) | 邮箱地址uuid | 3.7.0 | |
| endpointUuid | String | body(包含在updateEmailAddress结构中) | 接收端uuid | 3.7.0 | |
| emailAddress (可选) | String | body(包含在updateEmailAddress结构中) | 新邮箱地址 | 3.7.0 | |
| systemTags (可选) | List | body | 3.7.0 | ||
| userTags (可选) | List | body | 3.7.0 |
API返回
返回示例
{
"inventory": {
"uuid": "a78dca4fecd0475c8c164758e653631e",
"emailAddress": "example@cloud.io",
"endpointUuid": "bc36eb9b20cc481ebaf251ec0b51c386"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 3.7.0 |
| inventory | SNSEmailAddressInventory | 详情参考inventory | 3.7.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 3.7.0 |
| description | String | 错误的概要描述 | 3.7.0 |
| details | String | 错误的详细信息 | 3.7.0 |
| elaboration | String | 保留字段,默认为null | 3.7.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 3.7.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 3.7.0 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 3.7.0 |
| emailAddress | String | 3.7.0 | |
| endpointUuid | String | 3.7.0 |
SDK示例
Java
SDK
UpdateEmailAddressOfSNSEmailEndpointAction action = new UpdateEmailAddressOfSNSEmailEndpointAction();
action.emailAddressUuid = "cb2b3d85e0da3a299c52c23510ba15dd";
action.endpointUuid = "f305528eb6773a73beac3f94f79d3017";
action.emailAddress = "example@cloud.io";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateEmailAddressOfSNSEmailEndpointAction.Result res = action.call();Python
SDK
UpdateEmailAddressOfSNSEmailEndpointAction action = UpdateEmailAddressOfSNSEmailEndpointAction()
action.emailAddressUuid = "cb2b3d85e0da3a299c52c23510ba15dd"
action.endpointUuid = "f305528eb6773a73beac3f94f79d3017"
action.emailAddress = "example@cloud.io"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateEmailAddressOfSNSEmailEndpointAction.Result res = action.call()删除邮箱接收端的地址(DeleteEmailAddressOfSNSEmailEndpoint)
API请求
URLs
DELETE zstack/v1/sns/application-endpoints/emails/{endpointUuid}/email-addresses/{emailAddressUuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/sns/application-endpoints/emails/c9d1789432133840862986db31a8e3fb/email-addresses/7671c40279e23d1cba927a5726957fcb参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| emailAddressUuid | String | url | 3.7.0 | ||
| endpointUuid | String | url | 3.7.0 | ||
| systemTags (可选) | List | body | 3.7.0 | ||
| userTags (可选) | List | body | 3.7.0 |
API返回
该API成功时返回一个空的JSON结构
{},出错时返回的JSON结构包含一个error字段,例如:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
DeleteEmailAddressOfSNSEmailEndpointAction action = new DeleteEmailAddressOfSNSEmailEndpointAction();
action.emailAddressUuid = "7671c40279e23d1cba927a5726957fcb";
action.endpointUuid = "c9d1789432133840862986db31a8e3fb";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteEmailAddressOfSNSEmailEndpointAction.Result res = action.call();Python
SDK
DeleteEmailAddressOfSNSEmailEndpointAction action = DeleteEmailAddressOfSNSEmailEndpointAction()
action.emailAddressUuid = "7671c40279e23d1cba927a5726957fcb"
action.endpointUuid = "c9d1789432133840862986db31a8e3fb"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteEmailAddressOfSNSEmailEndpointAction.Result res = action.call()查询接收端邮箱地址(QuerySNSEmailAddress)
API请求
URLs
GET zstack/v1/sns/application-endpoints/emails/email-addressesGET zstack/v1/sns/application-endpoints/{endpointUuid}/emails/email-addresses/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-endpoints/emails/email-addresses?q=uuid=b1a8e21bed1e3592af8ba5ffff497af6&q=endpointUuid=547ffd3cbdb2399d8c6dde2d983502d5curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-endpoints/emails/email-addresses/9c1b8131d9a03e3b88602a5072a89c0b可查询字段
运行CLI命令行工具,输入QuerySNSEmailAddress并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"uuid": "102431efdb133a70b7e04347de22e396",
"emailAddress": "test@cloud.io",
"endpointUuid": "4ff65a1d7762348495dd0c4da110d7cd",
"createDate": "Oct 9, 2019 10:45:40 AM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 3.7.0 |
| inventories | List | 详情参考inventories | 3.7.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 3.7.0 |
| description | String | 错误的概要描述 | 3.7.0 |
| details | String | 错误的详细信息 | 3.7.0 |
| elaboration | String | 保留字段,默认为null | 3.7.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 3.7.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 3.7.0 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 3.7.0 |
| emailAddress | String | 3.7.0 | |
| endpointUuid | String | 3.7.0 | |
| createDate | Timestamp | 创建时间 | 3.7.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 3.7.0 |
SDK示例
Java
SDK
QuerySNSEmailAddressAction action = new QuerySNSEmailAddressAction();
action.conditions = asList("uuid=19beae4d7df63aa6ba24b7422521af7b","endpointUuid=4758483d0db33c6bb82961d4c1e837aa");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySNSEmailAddressAction.Result res = action.call();Python
SDK
QuerySNSEmailAddressAction action = QuerySNSEmailAddressAction()
action.conditions = ["uuid=2ab2f6138c1c3b98b5834764c29dd596","endpointUuid=01106fe537473575be43fec7173e2dd1"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySNSEmailAddressAction.Result res = action.call()创建微软Teams接收端(CreateSNSMicrosoftTeamsEndpoint)
API请求
URLs
POST zstack/v1/sns/application-endpoints/microsoft-teamsHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"url": "http://teams-robot-url",
"name": "Microsoft teams"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"url":"http://teams-robot-url","name":"Microsoft teams"}}' http://localhost:8080/zstack/v1/sns/application-endpoints/microsoft-teams参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| url | String | body(包含在params结构中) | 连接器的url | 3.10.0 | |
| name | String | body(包含在params结构中) | 资源名称 | 3.10.0 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 3.10.0 | |
| platformUuid (可选) | String | body(包含在params结构中) | 3.10.0 | ||
| resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID | 3.10.0 | |
| tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 3.10.0 | |
| systemTags (可选) | List | body | 系统标签 | 3.10.0 | |
| userTags (可选) | List | body | 用户标签 | 3.10.0 |
API返回
返回示例
{
"inventory": {
"url": "http://teams-robot-url",
"name": "example",
"uuid": "917fe66f76b241f0843dfbd6be685fc1",
"description": "description example",
"type": "Email",
"state": "Enabled",
"platformUuid": "4eb0ceebf95b452585ebeacd647d9f35",
"createDate": "Aug 21, 2020 2:17:23 PM",
"lastOpDate": "Aug 21, 2020 2:17:23 PM"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 3.10.0 |
| inventory | SNSSmsEndpointInventory | 详情参考inventory | 3.10.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 3.10.0 |
| description | String | 错误的概要描述 | 3.10.0 |
| details | String | 错误的详细信息 | 3.10.0 |
| elaboration | String | 保留字段,默认为null | 3.10.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 3.10.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 3.10.0 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| url | String | 连接器的url | 3.10.0 |
| name | String | 资源名称 | 3.10.0 |
| uuid | String | 资源的UUID,唯一标示该资源 | 3.10.0 |
| description | String | 资源的详细描述 | 3.10.0 |
| type | String | 3.10.0 | |
| state | String | 3.10.0 | |
| platformUuid | String | 3.10.0 | |
| createDate | Timestamp | 创建时间 | 3.10.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 3.10.0 |
SDK示例
Java
SDK
CreateSNSMicrosoftTeamsEndpointAction action = new CreateSNSMicrosoftTeamsEndpointAction();
action.url = "http://teams-robot-url";
action.name = "Microsoft teams";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSNSMicrosoftTeamsEndpointAction.Result res = action.call();Python
SDK
CreateSNSMicrosoftTeamsEndpointAction action = CreateSNSMicrosoftTeamsEndpointAction()
action.url = "http://teams-robot-url"
action.name = "Microsoft teams"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSNSMicrosoftTeamsEndpointAction.Result res = action.call()查询微软Teams接收端(QuerySNSMicrosoftTeamsEndpoint)
API请求
URLs
GET zstack/v1/sns/application-endpoints/microsoft-teamsGET zstack/v1/sns/application-endpoints/microsoft-teams/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-endpoints/microsoft-teams?q=url=http://teams-url可查询字段
运行CLI命令行工具,输入QuerySNSMicrosoftTeamsEndpoint并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
QuerySNSMicrosoftTeamsEndpointAction action = new QuerySNSMicrosoftTeamsEndpointAction();
action.conditions = asList("url=http://teams-url");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySNSMicrosoftTeamsEndpointAction.Result res = action.call();Python
SDK
QuerySNSMicrosoftTeamsEndpointAction action = QuerySNSMicrosoftTeamsEndpointAction()
action.conditions = ["url=http://teams-url"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySNSMicrosoftTeamsEndpointAction.Result res = action.call()订阅主题(SubscribeSNSTopic)
API请求
URLs
POST zstack/v1/sns/topics/{topicUuid}/endpoints/{endpointUuid}Headers
Authorization: OAuth the-session-uuidBody
{
"params": {},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' \
http://localhost:8080/zstack/v1/sns/topics/755ac6aea82f3365a66b86258c55189e/endpoints/c1f5c1e23ff13001b249c18253984741参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| topicUuid | String | url | 应用主题UUID | 2.3 | |
| endpointUuid | String | url | 终端UUID | 2.3 | |
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
SubscribeSNSTopicAction action = new SubscribeSNSTopicAction();
action.topicUuid = "755ac6aea82f3365a66b86258c55189e";
action.endpointUuid = "c1f5c1e23ff13001b249c18253984741";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SubscribeSNSTopicAction.Result res = action.call();Python
SDK
SubscribeSNSTopicAction action = SubscribeSNSTopicAction()
action.topicUuid = "755ac6aea82f3365a66b86258c55189e"
action.endpointUuid = "c1f5c1e23ff13001b249c18253984741"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SubscribeSNSTopicAction.Result res = action.call()查询订阅主题的终端(QuerySNSTopicSubscriber)
API请求
URLs
GET zstack/v1/sns/topics/subscribers
GET zstack/v1/sns/topics/subscribers/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/topics/subscribers?q=topicUuid=3677dc0f00964b80886f3b2bbf9338cdcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/topics/subscribers/15b4071325193fdcbae66b6388ea9c6f可查询字段
运行CLI命令行工具,输入QuerySNSTopicSubscriber并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"topicUuid": "3677dc0f00964b80886f3b2bbf9338cd",
"endpointUuid": "f8c5c56233844126ad5f5a0174da3098"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.3.1 |
| inventories | List | 详情参考inventories | 2.3.1 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 2.3.1 |
| description | String | 错误的概要描述 | 2.3.1 |
| details | String | 错误的详细信息 | 2.3.1 |
| elaboration | String | 保留字段,默认为null | 2.3.1 |
| opaque | LinkedHashMap | 保留字段,默认为null | 2.3.1 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 2.3.1 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| topicUuid | String | 主题UUID | 2.3.1 |
| endpointUuid | String | 终端UUID | 2.3.1 |
| createDate | Timestamp | 创建时间 | 2.3.1 |
| lastOpDate | Timestamp | 最后一次修改时间 | 2.3.1 |
SDK示例
Java
SDK
QuerySNSTopicSubscriberAction action = new QuerySNSTopicSubscriberAction();
action.conditions = asList("topicUuid=3677dc0f00964b80886f3b2bbf9338cd");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySNSTopicSubscriberAction.Result res = action.call();Python
SDK
QuerySNSTopicSubscriberAction action = QuerySNSTopicSubscriberAction()
action.conditions = ["topicUuid=3677dc0f00964b80886f3b2bbf9338cd"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySNSTopicSubscriberAction.Result res = action.call()退订主题(UnsubscribeSNSTopic)
API请求
URLs
DELETE zstack/v1/sns/topics/{topicUuid}/endpoints/{endpointUuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/sns/topics/bd6c49ad623a3740880ca6d3ed3bb793/endpoints/36d6eb53f7c23fbca1ac72008940efc8?参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| topicUuid | String | url | 主题UUID | 2.3 | |
| endpointUuid | String | url | 终端UUID | 2.3 | |
| systemTags (可选) | List | body | 系统标签 | 2.3 | |
| userTags (可选) | List | body | 用户标签 | 2.3 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
UnsubscribeSNSTopicAction action = new UnsubscribeSNSTopicAction();
action.topicUuid = "bd6c49ad623a3740880ca6d3ed3bb793";
action.endpointUuid = "36d6eb53f7c23fbca1ac72008940efc8";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UnsubscribeSNSTopicAction.Result res = action.call();Python
SDK
UnsubscribeSNSTopicAction action = UnsubscribeSNSTopicAction()
action.topicUuid = "bd6c49ad623a3740880ca6d3ed3bb793"
action.endpointUuid = "36d6eb53f7c23fbca1ac72008940efc8"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UnsubscribeSNSTopicAction.Result res = action.call()