General Cloud API Calls
v3.0.0+
The tcb api command has been available since v3.0.0.
tcb api is a general Tencent Cloud API entry point. It calls any Tencent Cloud API directly, and the CLI handles authentication and request encapsulation.
Basic Usage
tcb api <service> <action> [options]
Parameters:
| Parameter | Description | Required |
|---|---|---|
<service> | Tencent Cloud service name, such as tcb, scf, cls | Yes |
<action> | API Action name, such as DescribeEnvs | Yes |
--body <json> | Request body, a JSON string | No |
--api-version <version> | API version, such as 2019-09-24. Uses the service default version when omitted | No |
-e, --env-id <envId> | CloudBase environment ID | No |
--json | Output the result in JSON format | No |
Examples
# List all CloudBase environments
tcb api tcb DescribeEnvs
# Query a specific environment
tcb api tcb DescribeEnvs --body '{"EnvId":"my-env-id"}'
# List cloud functions (requires an environment)
tcb api scf ListFunctions -e my-env-id
# Specify the API version
tcb api tcb DescribeEnvs --api-version 2019-09-24
# Output in JSON format for scripts
tcb api tcb DescribeEnvs --json
--body must be valid JSON. The command fails immediately on a malformed value and sends no request.
Find service and action
Look them up in the Tencent Cloud API documentation:
serviceis the API domain prefix of the product, such astcb(CloudBase),scf(Cloud Functions),cls(Cloud Log Service).actionis the API name, such asDescribeEnvs,ListFunctions.
tcb apiauthenticates with the credentials of the current account, so no key configuration is needed. Runtcb loginfirst.
Command Reference
| Command | Description |
|---|---|
tcb api <service> <action> | Call a Tencent Cloud API |
tcb api <service> <action> --body <json> | Call with a request body |
tcb api <service> <action> --json | Output in JSON format |
Notes
- A small set of high-risk actions is on a built-in blocklist, for example CynosDB password reset and account deletion actions. The list cannot be disabled
- The response follows the original Tencent Cloud API schema, check the interface documentation for field meanings