General Cloud API Calls
1. API Description
manager-node provides a unified method call for commonService to invoke TencentCloud Cloud APIs.
API declaration: manager.commonService(service, version).call(option): Promise<Object>
⚠️ Starting from version 3.0.0, commonService is used as a method in this API with request parameters (service?: string, version?: string), which is an incompatible change.
2. Input Parameters
commonService method
| Field | Type | Required | Description |
|---|---|---|---|
| service | string | No | Service to which the request resource belongs |
| version | string | No | API version |
call method
| Field | Type | Required | Description |
|---|---|---|---|
| - | ICommonApiServiceOption | Yes | Common API parameter passing |
ICommonApiServiceOption struct
| Field | Type | Required | Description |
|---|---|---|---|
| Action | String | Yes | API name |
| Param | Object | Yes | API parameters; refer to the respective API documentation for specific forms |
3. Return Results
| Field | Type | Required | Description |
|---|---|---|---|
| - | Object | Yes | Response object varies by action. |
4. Sample Code
import CloudBase from '@cloudbase/manager-node'
const manager = new CloudBase({
secretId: 'Your SecretId',
secretKey: 'Your SecretKey',
envId: 'Your envId' // TCB environment ID, which can be obtained from the Tencent Cloud TCB console
})
async function test() {
const res = await manager.commonService().call({
Action: 'DescribeDatabaseACL',
Param: {
CollectionName: 'xxx',
EnvId: 'xxx'
}
})
console.log(res)
}
test()