Document navigation

CreateSNSTopic

API Request

URLs
POST zstack/v1/sns/topics
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "api topic",
    "locale": "zh_CN"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the above example, the systemTags and userTags fields are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"api topic","locale":"zh_CN"}}' \
http://localhost:8080/zstack/v1/sns/topics
Parameter List
Name Type Location Description Allowed Values Starting Version
name String body (contained in the params structure) Resource name 2.3
description (Optional) String body (contained in the params structure) Detailed description of the resource 2.3
resourceUuid (Optional) String body (contained in the params structure) Optional. The resource UUID. 2.3
systemTags (Optional) List body System tags 2.3
userTags (Optional) List body User tags 2.3
tagUuids (Optional) List body (contained in the params structure) Tag UUID list 5.0.0
locale (Optional) String body (contained in the params structure) Internationalization language
  • zh_CN
  • en_US
5.0.0

API Response

Response Example
{
  "inventory": {
    "uuid": "b3033f326b9d4f0fb01fa900d2dd6c2f",
    "name": "new name",
    "state": "Enabled",
    "locale": "zh_CN",
    "createDate": "Mar 26, 2024 2:46:30 AM",
    "lastOpDate": "Mar 26, 2024 2:46:30 AM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 5.0.0
error ErrorCode The error code. If not null, the operation failed. This field is null on success. See error 2.3
inventory SNSTopicInventory See inventory 2.3
#error
Name Type Description Starting Version
code String The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 0.6
description String A brief description of the error 0.6
details String Detailed information about the error 0.6
elaboration String Reserved field. Default is null 0.6
opaque LinkedHashMap Reserved field. Default is null 0.6
cause ErrorCode The root error that caused the current error. If there is no root error, this field is null 0.6
#inventory
Name Type Description Starting Version
uuid String The UUID of the resource, which uniquely identifies the resource 2.3
name String Resource name 2.3
description String Detailed description of the resource 2.3
state String State 2.3
lastOpDate Timestamp Last modification time 2.3
createDate Timestamp Creation time 2.3

SDK Examples

Java SDK
CreateSNSTopicAction action = new CreateSNSTopicAction();
action.name = "api topic";
action.locale = "zh_CN";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSNSTopicAction.Result res = action.call();
Python SDK
CreateSNSTopicAction action = CreateSNSTopicAction()
action.name = "api topic"
action.locale = "zh_CN"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSNSTopicAction.Result res = action.call()
API Reference | ZStack ZSphere · ZVF | ZStack Resource Center