1. API Description
Domain name for API request: cam.intl.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.
We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.
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 Params. The value used for this API: GetPolicy. |
| Version |
Yes |
String |
Common Params. The value used for this API: 2019-01-16. |
| Region |
No |
String |
Common Params. 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. |
| PresetAlias |
String |
Remarks Note: this field may return null, indicating that no valid values can be obtained. |
| IsServiceLinkedRolePolicy |
Integer |
Whether it is a service-linked policy Note: this field may return null, indicating that no valid values can be obtained. |
| 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
https:
&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",
"PresetAlias": "Remarks",
"IsServiceLinkedRolePolicy": 0
}
}
5. Developer Resources
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. |