GetPolicy

Last updated: 2020-01-13 17:31:09

1. API Description

Domain name for API request: cam.tencentcloudapi.com.

This API (GetPolicy) is used to query and view policy details.

A maximum of 20 requests can be initiated per second for this API.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: GetPolicy
Version Yes String Common parameter. The value used for this API: 2019-01-16
Region No String Common parameter. This parameter is not required for this API.
PolicyId Yes Integer Policy ID

3. Output Parameters

Parameter Name Type Description
PolicyName String Policy name
Note: This field may return null, indicating that no valid value was found.
Description String Policy description
Note: This field may return null, indicating that no valid value was found.
Type Integer 1: Custom policy; 2: Preset policy
Note: This field may return null, indicating that no valid value was found.
AddTime Timestamp Time created
Note: This field may return null, indicating that no valid value was found.
UpdateTime Timestamp Time of latest update
Note: This field may return null, indicating that no valid value was found.
PolicyDocument String Policy document
Note: This field may return null, indicating that no valid value was found.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Querying Policy Details

Input Example

https://cam.tencentcloudapi.com/?Action=GetPolicy
&PolicyId=17698703
&<Common Request Parameters>

Output Example

{
  "Response": {
    "PolicyDocument": "{\"version\":\"2.0\",\"statement\":[{\"effect\":\"allow\",\"action\":[\"name\\/cos:*\"],\"resource\":[\"*\"]}]}",
    "UpdateTime": "2019-04-29 21:28:32",
    "AddTime": "2019-04-29 21:18:40",
    "PolicyName": "test-2019-04-29",
    "Description": "Test policy",
    "Type": 1,
    "RequestId": "845b309d-e531-402d-a4f6-ec124f06738b"
  }
}

5. Developer Resources

API Explorer

This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError.SystemError Internal error.
InvalidParameter.ParamError Invalid input parameter.
InvalidParameter.PolicyIdError Input parameter PolicyId invalid.
ResourceNotFound.PolicyIdNotFound Resources specified by PolicyId does not exist.