Adding Topic Permissions
Function
This API is used to add permissions of a topic.
URI
POST /v2/{project_id}/mqs/instances/{instance_id}/topics/{topic_name}/access-policies/batch-add
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 |
topic_name |
Yes |
String |
Topic name. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
No |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
policies |
Yes |
Array of PolicyEntity objects |
Topic Permissions |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
user_name |
Yes |
String |
Application key (access key) |
app_name |
Yes |
String |
Application name. |
access_policy |
Yes |
String |
Permission type:
|
tag |
No |
String |
Tags corresponding to the permission type. When the access policy type is all, separate publish and subscribe tags by ampersands (&). Separate multiple tags by double vertical bars (||). Use only digits, letters, hyphens (-), and underscores (_) with a maximum of 48 characters. |
Response Parameters
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
https://{endpoint}/v2/{project_id}/mqs/instances/{instance_id}/topics/{topic_name}/access-policies/batch-add { "policies" : [ { "user_name" : "62034763-c4aa-416f-975d-1452ba90fec2", "app_name" : "app-uve7", "access_policy" : "sub", "tag" : "123&abc" } ] }
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 |
No Content |
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.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot