General Cloud API Calls
v3.0.0+
The tcb api command has been available since v3.0.0.
The tcb api command provides a unified access point for Tencent Cloud API calls, allowing direct invocation of any Tencent Cloud API interface via the command line without manual authentication processing or request encapsulation.
Basic Usage
tcb api <service> <action> [options]
Parameter Description:
| 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, JSON string | No |
--version <version> | API version number, such as 2019-09-24 (optional; if not specified, the service default version is used) | No |
-e, --env-id <envId> | TCB environment ID | No |
--json | Output the result in JSON format | No |
Usage Example
# List All TCB Environments
tcb api tcb DescribeEnvs
# Query Specific Environment
tcb api tcb DescribeEnvs --body '{"EnvId":"my-env-id"}'
# List SCF Functions (Environment Must Be Specified)
tcb api scf ListFunctions -e my-env-id
# Specify API Version
tcb api tcb DescribeEnvs --version 2019-09-24
# Output in JSON Format (Suitable for Script Processing)
tcb api tcb DescribeEnvs --json
How to Find service and action?
- Tencent Cloud API Documentation: https://cloud.tencent.com/document/api
servicecorresponds to the API domain prefix for each product, such astcb(TCB),scf(SCF),cls(Cloud Log Service)actioncorresponds to the specific API name, such asDescribeEnvs,ListFunctions
tip
The tcb api command uses the credentials of the currently logged-in account for authentication, without requiring additional configuration of keys. Before making calls, ensure you have executed tcb login.
Command Quick Reference
| Command | Description |
|---|---|
tcb api <service> <action> | Call Tencent Cloud API |
tcb api <service> <action> --body <json> | Call with a request body |
tcb api <service> <action> --json | Outputs in JSON format |