GetPolicy

Last updated: 2019-09-09 21:43:45

PDF

1. API Description

API domain name: cam.tencentcloudapi.com.

This API (GetPolicy) queries and views policy details.

Default API request rate limit: 20 requests/sec.

2. Input Parameters

The following parameters are required for requesting this API, including action-specific parameters and common parameters. For more information about common parameters for all requests, see Common Request Parameters.

Parameter name Required Type Description
Action Yes String Common parameter; the name of this API: GetPolicy
Version Yes String Common parameter; the version of this API: 2019-01-16
Region No String Common parameter; optional 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 values can be obtained.
Description String Policy description
Note: This field may return null, indicating that no valid values can be obtained.
Type Integer 1: custom policy; 2: predefined policy
Note: This field may return null, indicating that no valid values can be obtained.
AddTime Timestamp Creation time
Note: This field may return null, indicating that no valid values can be obtained.
UpdateTime Timestamp Last update time
Note: This field may return null, indicating that no valid values can be obtained.
PolicyDocument String Policy document
Note: This field may return null, indicating that no valid values can be obtained.
RequestId String The ID of the request. Each request returns a unique ID. The RequestId is required to troubleshoot issues.

4. Sample

Sample 1. Viewing the Details of a Policy

Input Sample Code

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

Output Sample Code

{
  "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 provides various capabilities such as online call, signature verification, SDK code generation, and quick API retrieval that significantly reduce the difficulty of using TencentCloud API.

SDK

TencentCloud API 3.0 integrates software development toolkits (SDKs) that support various programming languages to make it easier for you to call the APIs.

TCCLI

6. Error Codes

The following error codes are API business logic-related. For other error codes, see Common Error Codes.

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