doc-exports/docs/smn/api-ref/smn_api_51006.html
guoyanyan feae604f17 SMN API 20220929 v1
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: guoyanyan <guoyanyan3@huawei.com>
Co-committed-by: guoyanyan <guoyanyan3@huawei.com>
2022-11-10 09:15:21 +00:00

135 lines
9.5 KiB
HTML

<a name="smn_api_51006"></a><a name="smn_api_51006"></a>
<h1 class="topictitle1">Querying Topic Attributes</h1>
<div id="body1474599764593"><div class="section" id="smn_api_51006__section64935954"><h4 class="sectiontitle">Description</h4><ul id="smn_api_51006__ul33304380203733"><li id="smn_api_51006__li51147505203733">API name<p id="smn_api_51006__p38624841203741">ListTopicAttributes</p>
</li></ul>
<ul id="smn_api_51006__ul20998054203745"><li id="smn_api_51006__li46884910203750">Function<p id="smn_api_51006__p4186593495020">Query the topic attribute information.</p>
</li></ul>
</div>
<div class="section" id="smn_api_51006__section47552675"><h4 class="sectiontitle">URI</h4><ul id="smn_api_51006__ul30639779"><li id="smn_api_51006__li7322556">URI format<p id="smn_api_51006__p65903005">GET /v2/{project_id}/notifications/topics/{topic_urn}/attributes?name={name}</p>
</li></ul>
<ul id="smn_api_51006__ul56256135"><li id="smn_api_51006__li36543171">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_51006__table60453091" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_51006__row31471768"><th align="left" class="cellrowborder" valign="top" width="23.69%" id="mcps1.3.2.3.1.1.1.5.1.1"><p id="smn_api_51006__p66185246"><strong id="smn_api_51006__b842352706191030">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21.349999999999998%" id="mcps1.3.2.3.1.1.1.5.1.2"><p id="smn_api_51006__p59404709"><strong id="smn_api_51006__b593421527191713">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="24.64%" id="mcps1.3.2.3.1.1.1.5.1.3"><p id="smn_api_51006__p47052116"><strong id="smn_api_51006__b84235270619112">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="30.320000000000004%" id="mcps1.3.2.3.1.1.1.5.1.4"><p id="smn_api_51006__p53125076"><strong id="smn_api_51006__b84235270619115">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="smn_api_51006__row57297510"><td class="cellrowborder" valign="top" width="23.69%" headers="mcps1.3.2.3.1.1.1.5.1.1 "><p id="smn_api_51006__p10586695">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="21.349999999999998%" headers="mcps1.3.2.3.1.1.1.5.1.2 "><p id="smn_api_51006__p52215961">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="24.64%" headers="mcps1.3.2.3.1.1.1.5.1.3 "><p id="smn_api_51006__p1634435">String</p>
</td>
<td class="cellrowborder" valign="top" width="30.320000000000004%" headers="mcps1.3.2.3.1.1.1.5.1.4 "><p id="smn_api_51006__p5162792715506">Project ID</p>
<p id="smn_api_51006__p65280430">See <a href="smn_api_66000.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
<tr id="smn_api_51006__row9249362"><td class="cellrowborder" valign="top" width="23.69%" headers="mcps1.3.2.3.1.1.1.5.1.1 "><p id="smn_api_51006__p11000853">topic_urn</p>
</td>
<td class="cellrowborder" valign="top" width="21.349999999999998%" headers="mcps1.3.2.3.1.1.1.5.1.2 "><p id="smn_api_51006__p18653909">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="24.64%" headers="mcps1.3.2.3.1.1.1.5.1.3 "><p id="smn_api_51006__p34571641">String</p>
</td>
<td class="cellrowborder" valign="top" width="30.320000000000004%" headers="mcps1.3.2.3.1.1.1.5.1.4 "><p id="smn_api_51006__p48839530">Unique resource ID of a topic. You can obtain it according to <a href="smn_api_51004.html">Querying Topics</a>.</p>
</td>
</tr>
<tr id="smn_api_51006__row28333568111935"><td class="cellrowborder" valign="top" width="23.69%" headers="mcps1.3.2.3.1.1.1.5.1.1 "><p id="smn_api_51006__p13317684111935">name</p>
</td>
<td class="cellrowborder" valign="top" width="21.349999999999998%" headers="mcps1.3.2.3.1.1.1.5.1.2 "><p id="smn_api_51006__p4990583111935">No</p>
</td>
<td class="cellrowborder" valign="top" width="24.64%" headers="mcps1.3.2.3.1.1.1.5.1.3 "><p id="smn_api_51006__p1584116111935">String</p>
</td>
<td class="cellrowborder" valign="top" width="30.320000000000004%" headers="mcps1.3.2.3.1.1.1.5.1.4 "><p id="smn_api_51006__p61204561111935">Attribute name</p>
<p id="smn_api_51006__p363615525300">Only specified attribute names are supported. For details, see section <a href="smn_api_a1000.html">Topic Attribute List</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="note" id="smn_api_51006__note4215781214373"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="smn_api_51006__p4387598914373">If the <strong id="smn_api_51006__b842352706163643">name</strong> parameter is not specified, all attribute values of the topic are queried. The supported attribute values are provided in section <a href="smn_api_a1000.html">Topic Attribute List</a>.</p>
</div></div>
</li></ul>
</div>
<div class="section" id="smn_api_51006__section25320898"><h4 class="sectiontitle">Request</h4><div class="p" id="smn_api_51006__p4773384111587">Request example<pre class="screen" id="smn_api_51006__screen61381144104610">GET https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/urn:smn:regionId:8bad8a40e0f7462f8c1676e3f93a8183:test_create_topic_v2/attributes?name=access_policy</pre>
</div>
</div>
<div class="section" id="smn_api_51006__section26561495"><h4 class="sectiontitle">Response</h4><ul id="smn_api_51006__ul42729680"><li id="smn_api_51006__li49022807">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_51006__table38552084" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_51006__row10058158"><th align="left" class="cellrowborder" valign="top" width="32.20322032203221%" id="mcps1.3.4.2.1.1.1.4.1.1"><p id="smn_api_51006__p9404449"><strong id="smn_api_51006__b1910858008">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="32.20322032203221%" id="mcps1.3.4.2.1.1.1.4.1.2"><p id="smn_api_51006__p23562876"><strong id="smn_api_51006__b591968115">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="35.5935593559356%" id="mcps1.3.4.2.1.1.1.4.1.3"><p id="smn_api_51006__p29544808"><strong id="smn_api_51006__b585962561">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="smn_api_51006__row33089041"><td class="cellrowborder" valign="top" width="32.20322032203221%" headers="mcps1.3.4.2.1.1.1.4.1.1 "><p id="smn_api_51006__p62966687">request_id</p>
</td>
<td class="cellrowborder" valign="top" width="32.20322032203221%" headers="mcps1.3.4.2.1.1.1.4.1.2 "><p id="smn_api_51006__p27997">String</p>
</td>
<td class="cellrowborder" valign="top" width="35.5935593559356%" headers="mcps1.3.4.2.1.1.1.4.1.3 "><p id="smn_api_51006__p2267763">Request ID, which is unique</p>
</td>
</tr>
<tr id="smn_api_51006__row42586845"><td class="cellrowborder" valign="top" width="32.20322032203221%" headers="mcps1.3.4.2.1.1.1.4.1.1 "><p id="smn_api_51006__p266368914302">attributes</p>
</td>
<td class="cellrowborder" valign="top" width="32.20322032203221%" headers="mcps1.3.4.2.1.1.1.4.1.2 "><p id="smn_api_51006__p38092711">Map</p>
</td>
<td class="cellrowborder" valign="top" width="35.5935593559356%" headers="mcps1.3.4.2.1.1.1.4.1.3 "><p id="smn_api_51006__p65610739">Attribute key-value pair</p>
<p id="smn_api_51006__p87064812277"><strong id="smn_api_51006__b185226195816">access_policy</strong>: topic access policy</p>
<p id="smn_api_51006__p6701648192711"><strong id="smn_api_51006__b6230205945818">introduction</strong>: description of a topic</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="smn_api_51006__li32325424">Response example<pre class="screen" id="smn_api_51006__screen13964605171723">{
"request_id":"6837531fd3f54550927b930180a706bf",
"attributes": {
"access_policy": "{
"Version": "2016-09-07",
"Id": "__default_policy_ID",
"Statement": [
{
"Sid": "__user_pub_0",
"Effect": "Allow",
"Principal": {
"CSP": [
"urn:csp:iam::93dc1b4697ac493d9b7d089569f86b32:root"
]
},
"Action": ["SMN:Publish","SMN:QueryTopicDetail"],
"Resource": "urn:smn:regionId:8bad8a40e0f7462f8c1676e3f93a8183:aaa"
},
{
"Sid": "__service_pub_0",
"Effect": "Allow",
"Principal": {
"Service": ["obs"]
},
"Action": ["SMN:Publish","SMN:QueryTopicDetail"],
"Resource": "urn:smn:regionId:8bad8a40e0f7462f8c1676e3f93a8183:aaa"
}
]
}"
}
}</pre>
<div class="note" id="smn_api_51006__note761143628"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="smn_api_51006__p46212439214">The value of <strong id="smn_api_51006__b84235270618500">access_policy</strong> 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.</p>
</div></div>
</li></ul>
</div>
<div class="section" id="smn_api_51006__section37726867"><h4 class="sectiontitle">Returned Value</h4><p id="smn_api_51006__p64140254">See section <a href="smn_api_63002.html">Returned Value</a>.</p>
</div>
<div class="section" id="smn_api_51006__section73211020122511"><h4 class="sectiontitle">Error Code</h4><p id="smn_api_51006__p9759142919265">See section <a href="smn_api_64000.html">Error Code</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="smn_api_51000.html">Topic Operations</a></div>
</div>
</div>