• Simple Message Notification

smn
  1. Help Center
  2. Simple Message Notification
  3. API Reference
  4. APIs
  5. Topic Operations
  6. Modifying Topic Attributes

Modifying Topic Attributes

Description

  • API name

    UpdateTopicAttribute

  • Function

    Modify the topic attributes.

URI

  • URI format

    PUT /v2/{project_id}/notifications/topics/{topic_urn}/attributes/{name}

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID

    topic_urn

    Yes

    String

    Resource identifier of a topic, which is unique

    name

    Yes

    String

    Attribute name

    Only specified attribute names are supported. For details, see section Topic Attribute List.

Request

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    value

    Yes

    String

    Topic attribute value

    The value cannot exceed 30 KB.

  • Request example
    PUT /v2/{project_id}/notifications/topics/{topic_urn}/attributes/access_policy
    {
       "value": "{
             \"Version\": \"2016-09-07\", 
             \"Id\": \"__default_policy_ID\", 
             \"Statement\": [
                {
                  \"Sid\": \"__user_pub_0\",
                  \"Effect\": \"Allow\",
                  \"Principal\": {
                    \"CSP\": [
                            \"urn:csp:iam::{domainID}:root\"
                           ]
                     },
                  \"Action\": [\"SMN:Publish\",\"SMN:QueryTopicDetail\"],
                  \"Resource\": \"{topic_urn}\"
                  },
                  {
                  \"Sid\": \"__service_pub_0\", 
                  \"Effect\": \"Allow\",
                  \"Principal\": {
                     \"Service\": [\"obs\"]
                     },
                  \"Action\": [\"SMN:Publish\",\"SMN:QueryTopicDetail\"],
                  \"Resource\": \"{topic_urn}\"
                  }
                 ]
              }"
      }
    NOTE:
    • You need to replace {project_id}, {domainID}, and {topic_urn} with the actual values.

      domainID indicates the user's domain ID. To obtain it, log in to the SMN console, click My Credential in the username drop-down list on the upper right.

    • The value of access_policy is a JSON character string, which requires escape characters. While in the preceding example, the characters are not escaped. You need to escape them before using the policy.

Response

  • Parameter description

    Parameter

    Type

    Description

    request_id

    String

    Request ID, which is unique

  • Response example
    {
        "request_id":"6837531fd3f54550927b930180a706bf"
    }

Returned Value

See section Returned Value.

Error Code

See section Error Code.