Querying User Permissions

Function

This API is used to query user permissions.

User management is supported only when SASL is enabled for the Kafka instance.

Debugging

You can use API Explorer to debug this API.

URI

GET /v1/{project_id}/instances/{instance_id}/topics/{topic_name}/accesspolicy

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

instance_id

Yes

String

Instance ID.

topic_name

Yes

String

Topic name.

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

name

String

Topic name.

topic_type

Integer

Topic type.

policies

Array of PolicyEntity objects

Permission list.

Table 3 PolicyEntity

Parameter

Type

Description

owner

Boolean

Whether the user is the one selected during topic creation.

user_name

String

Username.

access_policy

String

Permission type.

  • all: publish and subscribe permissions.

  • pub: publish permissions.

  • sub: subscribe permissions.

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 403

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

This API is used to query user permissions for a topic.

GET https://{endpoint}/v1/{project_id}/instances/{instance_id}/topics/{topic_name}/accesspolicy

Example Responses

Status code: 200

Query succeeded.

{
  "name" : "topic-test",
  "policies" : [ {
    "owner" : false,
    "user_name" : "xxxa",
    "access_policy" : "pub"
  }, {
    "owner" : false,
    "user_name" : "root",
    "access_policy" : "all"
  } ],
  "topic_type" : 0
}

Status Codes

Status Code

Description

200

Query succeeded.

400

Invalid parameters.

403

Authorization failed.

Error Codes

See Error Codes.