edit-icon download-icon

View permission

Last Updated: Jan 30, 2018

OnsEmpowerList interface queries the authorization information of the target Topic on the specified account.

Usage

The Topic owner queries if a specified account is authorized to use a Topic he or she owns.The authorization type can be queried with this interface.

Restrictions on primary accounts and sub-accounts

This interface is exclusively available for primary accounts, and cannot be used by RAM sub-accounts.

Request parameters

Name Type Required Description
OnsRegionId String Yes The region where the queried MQ is currently located. It can be obtained through the OnsRegionList method.
OnsPlatform String No The source of the request, which by default is POP platform.
PreventCache Long Yes It’s used for CSRF verification. Set it to the current system time.
EmpowerUser Long Yes The queried target user ID; supports sub-account ID
Topic String No The queried target Topic which must be owned by the current user.

Response parameters

Name Type Description
RequestId String A public parameter unique for each request
HelpUrl String A help link
Data List(AuthOwnerInfoDo) The queried permission data list

AuthOwnerInfoDo structure

Name Type Description
Topic String The Topic name
Owner Long Owner UserId
Relation Integer Yes The authorization type: 2 for “authorize to send”; 4 for “authorize to subscribe”, and 6 for “authorize to send and subscribe”.
  • OnsEmpowerCreate: creates authorization
  • OnsEmpowerDelete: deletes authorization

Example

  1. public static void main(String []args) {
  2. public static void main(String []args) {
  3. String regionId = "cn-hangzhou";
  4. String accessKey = "XXXXXXXXXXXXXXXXX";
  5. String secretKey = "XXXXXXXXXXXXXXXXX";
  6. String endPointName ="cn-hangzhou";
  7. String productName ="Ons";
  8. String domain ="ons.cn-hangzhou.aliyuncs.com";
  9. /**
  10. *Select Region based on the region you will access, and set the corresponding access point.
  11. */
  12. try {
  13. DefaultProfile.addEndpoint(endPointNameregionIdproductNamedomain);
  14. } catch (ClientException e) {
  15. e.printStackTrace();
  16. }
  17. IClientProfile profile= DefaultProfile.getProfile(regionIdaccessKeysecretKey);
  18. IAcsClient iAcsClient= new DefaultAcsClient(profile);
  19. OnsEmpowerListRequest request = new OnsEmpowerListRequest();
  20. request.setOnsRegionId("cn-qingdao-publictest");
  21. request.setPreventCache(System.currentTimeMillis());
  22. request.setAcceptFormat(FormatType.JSON);
  23. request.setEmpowerUser("1675352326808602");
  24. request.setTopic("Topic_for_public_msg_test");
  25. try {
  26. OnsEmpowerListResponse response=iAcsClient.getAcsResponse(request);
  27. System.out.println(response.getRequestId());
  28. } catch (ServerException e) {
  29. e.printStackTrace();
  30. } catch (ClientException e) {
  31. e.printStackTrace();
  32. }
  33. }
  34. }
Thank you! We've received your feedback.