You can call GrantUserPermission to grant database and table permissions.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes GrantUserPermission

The operation that you want to perform. Valid values: GrantUserPermission

DbId String Yes 12**

The ID of the database.

DsType String Yes DATABASE

The type of the permission. Valid values:

  • DATABASE: the permissions of the physical DATABASE.
  • LOGIC_DATABASE: the logical database permission.
  • TABLE: permissions on physical tables.
  • LOGIC_TABLE: logical table permissions.
ExpireDate String Yes 2019-12-12 00:00:00

Permission expiration time

PermTypes String Yes QUERY, EXPORT, CORRECT

The permission type. Multiple permission types are separated by commas. Valid values:

  • QUERY: the QUERY permission.
  • EXPORT: the permission to EXPORT images.
  • CORRECT: change permissions.
Tid Long Yes -1

The ID of the tenant.

UserId String Yes 123**

The user ID, which corresponds to the user ID in the GetUser API. Note that this is not the Uid of a user.

Logic Boolean No false

Indicates whether the database was a logical database.

TableId String No 1324***

The ID of the table to be created. This parameter is required when you authorize the permissions on the table.

TableName String No table_name

Table name. This parameter is required when you authorize the permissions of a table.

Response parameters

Prameter Type Sample response Description
RequestId String A99CD576-1E18-4E86-931E-C3CCE5******

The ID of the request.

Success Boolean True

Indicates whether the request was successful.

ErrorMessage String UnknownError

Error message

ErrorCode String UnknownError

Error code

Examples

Sample request

http(s)://[Endpoint]/? Action=GrantUserPermission
&DbId=1234
&DsType=DATABASE
&ExpireDate=2019-12-12 00:00:00
&PermTypes=QUERY, EXPORT, CORRECT
&Tid=-1
&UserId=12345
&<Common request parameters>

Sample success responses

JSON format

{
  "RequestId": "A99CD576-1E18-4E86-931E-C3CCE5******",
  "Success": true
}

XML format

<RequestId>A99CD576-1E18-4E86-931E-C3CCE5******</RequestId>
<Success>true</Success>

Error codes.

For a list of error codes, visit the API Error Center.