Updating a Topic Permission
Function
This API is used to update the permission of a topic.
URI
POST /v2/{project_id}/mqs/instances/{instance_id}/topics/accesspolicy
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID. For details about how to obtain a project ID, see "Appendix" > "Obtaining a Project ID" in this document. |
| instance_id | Yes | String | Instance ID. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | User token, which can be obtained by calling the IAM API (value of X-Subject-Token in the response header). |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| topics | Yes | Array of UpdateTopicAccessPolicyTopicsObject objects | Policy list. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Topic name. |
| policies | Yes | Array of UpdateTopicAccessPolicyPoliciesObject objects | Access policies. |
| description | No | String | Description. |
| sensitive_word | No | String | Sensitive field. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| app_id | Yes | String | Integration application key. |
| app_key | No | String | Integration application key. |
| app_name | Yes | String | Application name. |
| access_policy | Yes | String | Permission type. |
| owner | No | Boolean | Whether the application is the one selected during topic creation. The default value is false. |
| tag | No | String | Tag corresponding to the permission type. When the permission type is all, publish and subscribe tags are separated by ampersands (&). Multiple tags are separated by double vertical bars (||). |
Response Parameters
Status code: 204
| Parameter | Type | Description |
|---|---|---|
| - | String | No Content |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Example Requests
Change access_policy of a topic's integration application to pub.
POST https://{endpoint}/v2/{project_id}/mqs/instances/{instance_id}/topics/accesspolicy
{
"topics" : [ {
"name" : "topic-test-mqs",
"policies" : [ {
"owner" : true,
"access_policy" : "pub",
"app_name" : "app-dhytest",
"tag" : "",
"app_id" : "cd28a9d9-2184-42ce-9fbe-f3785b6caada"
} ],
"sensitive_word" : "",
"description" : ""
} ]
} Example Responses
Status code: 400
Bad Request
{
"error_code" : 400,
"error_msg" : "Bad Request"
} Status code: 403
Forbidden
{
"error_code" : 403,
"error_msg" : "Forbidden"
} Status Codes
| Status Code | Description |
|---|---|
| 204 | The topic permission is updated. |
| 400 | Bad Request |
| 403 | Forbidden |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.