Updated on 2025-11-25 GMT+08:00

Adding v3 Permission Policies

Function

This API is used to add v3 permission policies to a specified stream.

Calling Method

For details, see Calling APIs.

URI

POST /v3/{project_id}/streams/{streamName}/policies

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

streamName

Yes

String

Name of the stream to which you want to add policies

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

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.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

stream_id

Yes

String

Unique ID of the stream

principal_id

Yes

String

Authorized user.

If the permission is granted to a specified tenant, the format is domainId. If the permission is granted to a specified sub-user of a tenant, the format is domainId of the sub-user.

You can add multiple accounts and separate them by commas (,), for example, domainId1,domainId2.

action_type

Yes

String

Authorization operation type.

- putRecords: Upload data.
                        - getRecords: Download data.
  • getStreamInfo: stream details.

effect

No

String

Authorization impact type

  • accept: The authorization operation is allowed.

Response Parameters

Status code: 200

The operation is successful.

None

Example Requests

  • Add permission policies for a tenant.

    POST https://{Endpoint}/v3/{project_id}/streams/{streamName}/policies
    
    {
      "stream_id" : "CiFdELMr0401K9GGZlp",
      "principal_id" : "domainid1",
      "action_type" : "putRecords",
      "effect" : "accept"
    }
  • Add permission policies for a sub-user.

    POST https://{Endpoint}/v3/{project_id}/streams/{streamName}/policies
    
    {
      "stream_id" : "CiFdELMr0401K9GGZlp",
      "principal_id" : "domainid1",
      "action_type" : "putRecords",
      "effect" : "accept"
    }

Example Responses

None

Status Codes

Status Code

Description

200

The operation is successful.

Error Codes

See Error Codes.