TencentDB for MongoDB

TencentDB for MongoDB
API Documentation
Product Documentation©2013-2022 Tencent Cloud. All rights reserved.

Page 1 of 190

TencentDB for MongoDB

Copyright Notice©2013-2024 Tencent Cloud. All rights reserved.
Copyright in this document is exclusively owned by Tencent Cloud. You must not reproduce, modify, copy or distributein any way, in whole or in part, the contents of this document without Tencent Cloud's the prior written consent.
Trademark Notice

All trademarks associated with Tencent Cloud and its services are owned by Tencent Cloud Computing (Beijing)
Company Limited and its affiliated companies. Trademarks of third parties referred to in this document are owned bytheir respective proprietors.
Service Statement
This document is intended to provide users with general information about Tencent Cloud's products and services
only and does not form part of Tencent Cloud's terms and conditions. Tencent Cloud's products or services are
subject to change. Specific products and services and the standards applicable to them are exclusively provided for in
Tencent Cloud's applicable terms and conditions.

©2013-2022 Tencent Cloud. All rights reserved.

Page 2 of 190

TencentDB for MongoDB

Contents
API Documentation
History
Introduction
API Category
Making API Requests
Request Structure
Common Params
Signature v3
Signature
Responses
Instance APIs
RenameInstance
OfflineIsolatedDBInstance
ModifyDBInstanceSpec
IsolateDBInstanceDescribeSpecInfo
DescribeDBInstances
DescribeClientConnections
CreateDBInstanceHour
AssignProject
RenewDBInstances
DescribeSlowLogs
DescribeSlowLogPatterns
InquirePriceRenewDBInstances
InquirePriceModifyDBInstanceSpec
InquirePriceCreateDBInstances
DescribeDBInstanceDeal
DescribeSecurityGroup
DescribeInstanceParams
ModifyDBInstanceSecurityGroup
ModifyDBInstanceNetworkAddress
Backup APIs
DescribeDBBackups
CreateBackupDBInstanceDescribeBackupDownloadTask©2013-2022 Tencent Cloud. All rights reserved.

Page 3 of 190

TencentDB for MongoDB

CreateBackupDownloadTask
Account APIs
ResetDBInstancePassword
Task APIs
DescribeAsyncRequestInfo
Other APIs
FlushInstanceRouterConfig
Data Types
Error Codes©2013-2022 Tencent Cloud. All rights reserved.

Page 4 of 190

TencentDB for MongoDB

API Documentation
History：

Last updated 2023-04-06 10:26:16

Release 14
Release time: 2023-04-06 10:18:55
Release updates:
Improvement to existing documentation.
Modified APIs:
DescribeDBInstances
Modified input parameters:Tags

Release 13
Release time: 2023-03-20 10:54:14
Release updates:
Improvement to existing documentation.
Modified APIs:
CreateDBInstanceHour
New input parameters:ReadonlyNodeNum, ReadonlyNodeAvailabilityZoneList, HiddenZone

Release 12
Release time: 2023-03-08 11:38:20
Release updates:
Improvement to existing documentation.
Deleted APIs:
DescribeBackupAccess©2013-2022 Tencent Cloud. All rights reserved.

Page 5 of 190

TencentDB for MongoDB

Modified APIs:
CreateDBInstanceNew input parameters:ReadonlyNodeNum, ReadonlyNodeAvailabilityZoneList, HiddenZone
InquirePriceCreateDBInstances
New input parameters:InstanceChargeType, MongosCpu, MongosMemory, MongosNum, ConfigServerCpu,
ConfigServerMemory, ConfigServerVolume
Modified input parameters:Period
Deleted data structures:
BackupFile
Modified data structures:InstanceDetail
New members:MongosNodeNum, MongosMemory, MongosCpuNum, ConfigServerNodeNum,
ConfigServerMemory, ConfigServerVolume, ConfigServerCpuNum, ReadonlyNodeNum

Release 11
Release time: 2022-06-15 16:11:13
Release updates:
Improvement to existing documentation.
Modified data structures:
SpecificationInfo
New members:SupportMultiAZ

Release 10
Release time: 2022-04-20 15:18:54
Release updates:
Improvement to existing documentation.
New APIs:
ModifyDBInstanceNetworkAddress©2013-2022 Tencent Cloud. All rights reserved.

Page 6 of 190

TencentDB for MongoDB

New data structures:
ModifyNetworkAddress

Release 9
Release time: 2022-03-15 11:19:31
Release updates:
Improvement to existing documentation.
New APIs:
ModifyDBInstanceSecurityGroup
Modified APIs:
InquirePriceModifyDBInstanceSpec
New input parameters:NodeNum, ReplicateSetNum
Modified data structures:
BackupDownloadTask
New members:BackupMethod, BackupDesc

Release 8
Release time: 2021-12-31 10:18:36
Release updates:
Improvement to existing documentation.
New APIs:
DescribeInstanceParams
New data structures:InstanceEnumParam
InstanceIntegerParam
InstanceMultiParam
InstanceTextParam©2013-2022 Tencent Cloud. All rights reserved.

Page 7 of 190

TencentDB for MongoDB

Modified data structures:
ClientConnection
New members:InternalService

Release 7
Release time: 2021-10-22 15:22:51
Release updates:
Improvement to existing documentation.
Modified APIs:
CreateDBInstanceNew input parameters:RestoreTime, InstanceName, AvailabilityZoneList, MongosCpu, MongosMemory,
MongosNodeNum
CreateDBInstanceHour
New input parameters:RestoreTime, InstanceName, AvailabilityZoneList, MongosCpu, MongosMemory,
MongosNodeNum

Release 6
Release time: 2021-09-03 17:12:40
Release updates:
Improvement to existing documentation.
Modified APIs:
ModifyDBInstanceSpec
New input parameters:NodeNum, ReplicateSetNum, InMaintenanceRelease 5
Release time: 2021-05-28 17:44:19
Release updates:
Improvement to existing documentation.

©2013-2022 Tencent Cloud. All rights reserved.

Page 8 of 190

TencentDB for MongoDB

Modified data structures:
SecurityGroupBound
New members:Id, AddressModule, ServiceModule, Desc

Release 4
Release time: 2021-05-25 19:18:45
Release updates:
Improvement to existing documentation.
New APIs:
CreateBackupDownloadTask
DescribeBackupDownloadTask
DescribeSecurityGroupNew data structures:
BackupDownloadTask
BackupDownloadTaskStatus
ReplicaSetInfo
SecurityGroup
SecurityGroupBound

Release 3
Release time: 2021-03-22 17:34:26
Release updates:
Improvement to existing documentation.
Modified APIs:
DescribeDBBackups
New input parameters:BackupMethod, Limit, Offset
DescribeDBInstances
New input parameters:Tags
DescribeSlowLogPatterns©2013-2022 Tencent Cloud. All rights reserved.

Page 9 of 190

TencentDB for MongoDB

New input parameters:Format
DescribeSlowLogs
New input parameters:Format

Release 2
Release time: 2020-08-13 23:23:08
Release updates:
Improvement to existing documentation.
New APIs:
CreateBackupDBInstanceDescribeAsyncRequestInfo
ResetDBInstancePassword

Existing Release
Release time: 2020-07-30 20:01:28
Existing APIs/data structures are as follows:
Improvement to existing documentation.
Existing APIs:
AssignProject
CreateDBInstance
CreateDBInstanceHour
DescribeBackupAccess
DescribeClientConnections
DescribeDBBackups
DescribeDBInstanceDeal
DescribeDBInstances
DescribeSlowLogPatterns
DescribeSlowLogs
DescribeSpecInfo
FlushInstanceRouterConfig
InquirePriceCreateDBInstances©2013-2022 Tencent Cloud. All rights reserved.

Page 10 of 190

TencentDB for MongoDB

InquirePriceModifyDBInstanceSpec
InquirePriceRenewDBInstances
IsolateDBInstance
ModifyDBInstanceSpec
OfflineIsolatedDBInstance
RenameInstanceRenewDBInstances
Existing data structures:
BackupFile
BackupInfo
ClientConnection
DBInstanceInfo
DBInstancePrice
InstanceChargePrepaid
InstanceDetail
ShardInfo
SlowLogPattern
SpecItemSpecificationInfo
TagInfo©2013-2022 Tencent Cloud. All rights reserved.

Page 11 of 190

TencentDB for MongoDB

Introduction：

Last updated 2021-03-24 17:06:36
TencentDB for MongoDB is a high-performance NoSQL database built by Tencent Cloud based on MongoDB, aglobally popular database program. Fully compatible with the MongoDB protocol, it provides stable and rich features
for monitoring, management, elastic scaling and automatic disaster recovery, making it ideal for document databasescenarios.

Note

：

All MongoDB APIs in this section have been upgraded to API 3.0. Future MongoDBfeatures will also be added
here. We recommend using API 3.0.

©2013-2022 Tencent Cloud. All rights reserved.

Page 12 of 190

TencentDB for MongoDB

API Category：

Last updated 2023-04-06 10:21:24

Instance APIs
API Name

FeatureFrequency
Limit

AssignProjectSpecifies the project to which a TencentDB instancebelongs

20

CreateDBInstance

Creates a monthly subscription TencentDB instance20

CreateDBInstanceHour

Creates a pay-as-you-go TencentDB instance20

DescribeClientConnections

Queries client connection information of an instance5

DescribeDBInstanceDeal

Gets order details of an instance5

DescribeDBInstances

Queries the list of TencentDB instances

20

DescribeInstanceParams

Queries the modifiable parameter list

20

DescribeSecurityGroup

Queries the security groups associated with an
instance

20

DescribeSlowLogPatterns

Gets slow log statistics

20

DescribeSpecInfo

Queries the specifications of purchasable TencentDB
instances10

InquirePriceCreateDBInstances

Queries price of instance creation

20

InquirePriceRenewDBInstances

Queries the renewal price of an instance20

IsolateDBInstance

Isolates a TencentDB Instance

20

ModifyDBInstanceNetworkAddress

Modifies the network settings of TencentDB instances

20

ModifyDBInstanceSecurityGroup

Modifies the security groups associated with an
instance

20

ModifyDBInstanceSpec

Adjusts the configurations of a TencentDB instance

20

OfflineIsolatedDBInstance

Deactivates isolated TencentDB instances

10©2013-2022 Tencent Cloud. All rights reserved.

Page 13 of 190

TencentDB for MongoDB

RenameInstance

Renames an instance20

RenewDBInstances

Renews a TencentDB instance20

DescribeSlowLogs

Gets slow log information

20

InquirePriceModifyDBInstanceSpec

Queries price of specification adjustment

20

Backup APIs
API Name

FeatureFrequency Limit

CreateBackupDBInstance

Creates instance backups

20

CreateBackupDownloadTask

Creates a backup download task

20

DescribeBackupDownloadTask

Queries backup download task information

20

DescribeDBBackups

Queries the list of instance backups

20

Account APIs
API Name

FeatureFrequency Limit

ResetDBInstancePassword

Modifies instance password

20

API Name

FeatureFrequency Limit

FlushInstanceRouterConfig

Flushes router configuration

20

API Name

FeatureFrequency Limit

DescribeAsyncRequestInfo

Queries async task status

20

Other APIs

Task APIs©2013-2022 Tencent Cloud. All rights reserved.

Page 14 of 190

TencentDB for MongoDB

Making API Requests
Request Structure：

Last updated 2023-03-08 12:00:24

1. Service Address
The API supports access from either a nearby region (at mongodb.tencentcloudapi.com) or a specified region (atmongodb.ap-guangzhou.tencentcloudapi.com for Guangzhou, for example).
We recommend using the domain name to access the nearest server. When you call an API, the request is
automatically resolved to a server in the region nearest to the location where the API is initiated. For example, when
you initiate an API request in Guangzhou, this domain name is automatically resolved to a Guangzhou server, theresult is the same as that of specifying the region in the domain like "mongodb.ap-guangzhou.tencentcloudapi.com".
Note: For latency-sensitive businesses, we recommend that you specify the region in the domain name.
Tencent Cloud currently supports the following regions:
Hosted region
Local access region (recommended, only for non-financial
availability zones)

Domain namemongodb.tencentcloudapi.com

South China (Guangzhou)

mongodb.apguangzhou.tencentcloudapi.com

East China (Shanghai)mongodb.apshanghai.tencentcloudapi.com

North China (Beijing)mongodb.apbeijing.tencentcloudapi.com

Southwest China (Chengdu)

mongodb.apchengdu.tencentcloudapi.com

Southwest China (Chongqing)Hong Kong, Macao, Taiwan (Hong Kong, China)
Southeast Asia (Singapore)©2013-2022 Tencent Cloud. All rights reserved.

mongodb.apchongqing.tencentcloudapi.com
mongodb.aphongkong.tencentcloudapi.com
mongodb.apsingapore.tencentcloudapi.com

Page 15 of 190

TencentDB for MongoDB

Southeast Asia (Bangkok)

mongodb.apbangkok.tencentcloudapi.com

South Asia (Mumbai)

mongodb.apmumbai.tencentcloudapi.com

Northeast Asia (Seoul)mongodb.ap-seoul.tencentcloudapi.com

Northeast Asia (Tokyo)

mongodb.ap-tokyo.tencentcloudapi.com

U.S. East Coast (Virginia)

mongodb.naashburn.tencentcloudapi.com

U.S. West Coast (Silicon Valley)mongodb.nasiliconvalley.tencentcloudapi.com

North America (Toronto)

mongodb.natoronto.tencentcloudapi.com

Europe (Frankfurt)mongodb.eufrankfurt.tencentcloudapi.com

2. Communications Protocol
All the Tencent Cloud APIs communicate via HTTPS, providing highly secure communication tunnels.

3. Request Methods
Supported HTTP request methods:
POST (recommended)GETThe Content-Type types supported by POST requests:
application/json (recommended). The TC3-HMAC-SHA256 signature algorithm must be used.
application/x-www-form-urlencoded. The HmacSHA1 or HmacSHA256 signature algorithm must be used.
multipart/form-data (only supported by certain APIs). You must use TC3-HMAC-SHA256 to calculate the signature.
The size of a GET request packet is up to 32 KB. The size of a POST request is up to 1 MB when the HmacSHA1 or
HmacSHA256 signature algorithm is used, and up to 10 MB when TC3-HMAC-SHA256 is used.

©2013-2022 Tencent Cloud. All rights reserved.

Page 16 of 190

TencentDB for MongoDB

4. Character Encoding
Only UTF-8 encoding is used.

©2013-2022 Tencent Cloud. All rights reserved.

Page 17 of 190

TencentDB for MongoDB

Common Params：

Last updated 2023-03-08 12:00:25
Common parameters are used for all APIs authenticating requestors. Common parameters must be included in all API
requests, and they will not be described in individual API documents.
The exact contents of the common parameters will vary depending on the version of the signature method you use.

Common parameters for Signature Algorithm v3
When the TC3-HMAC-SHA256 algorithm is used, the common parameters should be uniformly placed in the HTTP
request header, as shown below:
Parameter
Name

Type

Required

Description
The name of the API for the desired operation. For the specific value, see

X-TC-Action

X-TCRegion

X-TCTimestamp

StringStringYes

Yes

description of common parameter Action in the input parameters in r
documentation. For example, the API for querying the CVM instance list is
DescribeInstances .
Region parameter, which is used to identify the region to which the data ywork with belongs. For values supported for an API, see the description oparameter Region in the input parameters in related API documentati
parameter is not required for some APIs (which will be indicated in related
documentation), and will not take effect even it is passed.

Integer

X-TCVersion

StringAuthorization

StringYes

Yes

The current UNIX timestamp that records the time when the API request w
for example, 1529223702. Note: If the difference between the UNIX times
server time is greater than 5 minutes, a signature expiration error may occ
API version of the action. For the valid values, see the description of the cparameter Version in the API documentation. For example, the versi
2017-03-12.

Yes

The HTTP authentication request header, for example:
TC3-HMAC-SHA256 Credential=AKIDEXAMPLE/Date/service/tc3_requ
SignedHeaders=content-type;host,Signature=fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc96317
Here:- TC3-HMAC-SHA256: Signature method, currently fixed as this value;- Credential: Signature credential; AKIDEXAMPLE is the SecretId; Date is
UTC time, and this value must match the value of X-TC-Timestamp (a co©2013-2022 Tencent Cloud. All rights reserved.

Page 18 of 190

TencentDB for MongoDB

parameter) in UTC time format; service is the name of the product/service
generally a domain name prefix. For example, a domain name cvm.tencen
refers to the CVM product and the value would be cvm;
- SignedHeaders: The headers that contains the authentication informatio
type and host are the required headers;- Signature: Signature digest.

X-TC-Token

String

No

The token used for a temporary certificate. It must be used with a tempora
can obtain the temporary key and token by calling a CAM API. No token ia long-term key.

Assuming you want to query the list of Cloud Virtual Machine instances in the Guangzhou region, the request structurein the form of request URL, request header and request body may be as follows:
Example of an HTTP GET request structure:https://cvm.tencentcloudapi.com/?Limit=10&Offset=0
Authorization: TC3-HMAC-SHA256 Credential=AKIDz8krbsJ5yKBZQpn74WFkmLPx3EXAMPLE/20
18-10-09/cvm/tc3_request, SignedHeaders=content-type;host, Signature=5da7a33f6993
f0614b047e5df4582db9e9bf4672ba50567dba16c6ccf174c474
Content-Type: application/x-www-form-urlencoded
Host: cvm.tencentcloudapi.com
X-TC-Action: DescribeInstances
X-TC-Version: 2017-03-12
X-TC-Timestamp: 1539084154
X-TC-Region: ap-guangzhou
The following example shows you how to structure an HTTP POST (application/json) request:
https://cvm.tencentcloudapi.com/
Authorization: TC3-HMAC-SHA256 Credential=AKIDEXAMPLE/2018-05-30/cvm/tc3_request,
SignedHeaders=content-type;host, Signature=582c400e06b5924a6f2b5d7d672d79c15b1316
2d9279b0855cfba6789a8edb4c
Content-Type: application/json
Host: cvm.tencentcloudapi.com
X-TC-Action: DescribeInstances
X-TC-Version: 2017-03-12
X-TC-Timestamp: 1527672334
X-TC-Region: ap-guangzhou{"Offset":0,"Limit":10}
Example of an HTTP POST (multipart/form-data) request structure (only supported by specific APIs):©2013-2022 Tencent Cloud. All rights reserved.

Page 19 of 190

TencentDB for MongoDB

https://cvm.tencentcloudapi.com/
Authorization: TC3-HMAC-SHA256 Credential=AKIDEXAMPLE/2018-05-30/cvm/tc3_request,
SignedHeaders=content-type;host, Signature=582c400e06b5924a6f2b5d7d672d79c15b1316
2d9279b0855cfba6789a8edb4c
Content-Type: multipart/form-data; boundary=58731222010402
Host: cvm.tencentcloudapi.com
X-TC-Action: DescribeInstances
X-TC-Version: 2017-03-12
X-TC-Timestamp: 1527672334
X-TC-Region: ap-guangzhou--58731222010402
Content-Disposition: form-data; name="Offset"
0--58731222010402
Content-Disposition: form-data; name="Limit"
10--58731222010402--

Common parameters for Signature Algorithm v1
To adopt the HmacSHA1 and HmacSHA256 signature methods, common parameters must be put into the request
string, as shown below:
Parameter NameType

Required

Description
The name of the API for the desired operation. For the specificvalue, see the description of common parameter Action in the

ActionStringYes

input parameters in related API documentation. For example, theAPI for querying the CVM instance list is
DescribeInstances .
Region parameter, which is used to identify the region to which
the data you want to work with belongs. For values supported for
an API, see the description of common parameter Region in

RegionStringYes

the input parameters in related API documentation. Note: Thisparameter is not required for some APIs (which will be indicated inrelated API documentation), and will not take effect even if it ispassed.

©2013-2022 Tencent Cloud. All rights reserved.

Page 20 of 190

TencentDB for MongoDB

Timestamp

IntegerYes

The current UNIX timestamp that records the time when the API
request was initiated, for example, 1529223702. If the difference
between the value and the current system time is too large, asignature expiration error may occur.
A random positive integer used along with Timestamp to

Nonce

Integer

Yes

SecretId

StringYes

The identifying SecretId obtained on the Cloud API Key page. A
SecretId corresponds to a unique SecretKey which is used togenerate the request signature (Signature).

Yes

Request signature used to verify the validity of this request. This iscalculated based on the actual input parameters. For more
information about how this is calculated, see the API
authentication documentation.

Signature

VersionStringStringYes

prevent replay attacks.

API version of the action. For the valid values, see the descriptionof the common input parameter Version in the API
documentation. For example, the version of CVM is 2017-03-12.

SignatureMethod

StringNo

Signature method. Currently, only HmacSHA256 and HmacSHA1
are supported. The HmacSHA256 algorithm is used to verify thesignature only when this parameter is specified as HmacSHA256.
In other cases, the signature is verified with HmacSHA1.

Token

String

No

The token used for a temporary certificate. It must be used with atemporary key. You can obtain the temporary key and token bycalling a CAM API. No token is required for a long-term key.

Assuming you want to query the list of Cloud Virtual Machine instances in the Guangzhou region, the request structurein the form of request URL, request header and request body may be as follows:
Example of an HTTP GET request structure:https://cvm.tencentcloudapi.com/?Action=DescribeInstances&Version=2017-03-12&Sign
atureMethod=HmacSHA256&Timestamp=1527672334&Signature=37ac2f4fde00b0ac9bd9eadeb45
9b1bbee224158d66e7ae5fcadb70b2d181d02&Region=ap-guangzhou&Nonce=23823223&SecretId=AKIDEXAMPLE
Host: cvm.tencentcloudapi.com
Content-Type: application/x-www-form-urlencoded
Example of an HTTP POST request structure:©2013-2022 Tencent Cloud. All rights reserved.

Page 21 of 190

TencentDB for MongoDB

https://cvm.tencentcloudapi.com/
Host: cvm.tencentcloudapi.com
Content-Type: application/x-www-form-urlencoded
Action=DescribeInstances&Version=2017-03-12&SignatureMethod=HmacSHA256&Timestamp=
1527672334&Signature=37ac2f4fde00b0ac9bd9eadeb459b1bbee224158d66e7ae5fcadb70b2d18
1d02&Region=ap-guangzhou&Nonce=23823223&SecretId=AKIDEXAMPLE©2013-2022 Tencent Cloud. All rights reserved.

Page 22 of 190

TencentDB for MongoDB

Signature v3：

Last updated 2020-09-10 18:04:41
TencentCloud API authenticates every single request, i.e., the request must be signed using the security credentials inthe designated steps. Each request has to contain the signature information (Signature) in the common request
parameters and be sent in the specified way and format.

Applying for Security Credentials
The security credential used in this document is a key, which includes a SecretId and a SecretKey. Each user canhave up to two pairs of keys.
SecretId: Used to identify the API caller, which is just like a username.
SecretKey: Used to authenticate the API caller, which is just like a password.
You must keep your security credentials private and avoid disclosure; otherwise, your assets may becompromised. If they are disclosed, please disable them as soon as possible.
You can apply for the security credentials through the following steps:
1. Log in to the Tencent Cloud Console.
2. Go to the TencentCloud API Key console page.
3. On the TencentCloud API Key page, click Create to create a SecretId/SecretKey pair.

Using the Resources for Developers
TencentCloud API comes with SDKs for seven commonly used programming languages, including Python, Java,
PHP, Go, NodeJS and .NET. In addition, it provides API Explorer which enables online call, signature verification, andSDK code generation. If you have any troubles calculating a signature, consult these resources.

TC3-HMAC-SHA256 Signature Algorithm
Compatible with the previous HmacSHA1 and HmacSHA256 signature algorithms, the TC3-HMAC-SHA256
signature algorithm is more secure and supports larger requests and JSON format with better performance. We
recommend using TC3-HMAC-SHA256 to calculate the signature.
TencentCloud API supports both GET and POST requests. For the GET method, only the Content-Type:application/x-www-form-urlencoded protocol format is supported. For the POST method, two protocol formats,©2013-2022 Tencent Cloud. All rights reserved.

Page 23 of 190

TencentDB for MongoDB

Content-Type: application/json and Content-Type: multipart/form-data, are supported. The JSON format is supported
by default for all business APIs, and the multipart format is supported only for specific business APIs. In this case, theAPI cannot be called in JSON format. See the specific business API documentation for more information. The POST
method is recommended, as there is no difference in the results of both the methods, but the GET method only
supports request packets up to 32 KB.
The following uses querying the list of CVM instances in the Guangzhou region as an example to describe the steps ofsignature splicing. We chose this API because:
1. CVM is activated by default, and this API is often used;
2. It is read-only and does not change the status of existing resources;
3. It covers many types of parameters, which allows it to be used to demonstrate how to use arrays containing data
structures.
In the example, we try to choose common parameters and API parameters that are prone to mistakes. When you
actually call an API, please use parameters based on the actual conditions. The parameters vary by API. Do not copy
the parameters and values in this example.
Assuming that your SecretId and SecretKey are AKIDz8krbsJ5yKBZQpn74WFkmLPx3******* andGu5t9xGARNpq86cd98joQYCN3******* , respectively, if you want to view the status of the instance in the
Guangzhou region whose CVM instance name is "unnamed" and have only one data entry returned, then the request
may be:curl -X POST https://cvm.tencentcloudapi.com \-H "Authorization: TC3-HMAC-SHA256 Credential=AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******/2019-02-25/cvm/tc3_request, SignedHeaders=content-type;host, Signature=c492e8e4
1437e97a620b728c301bb8d17e7dc0c17eeabce80c20cd70fc3a78ff" \-H "Content-Type: application/json; charset=utf-8" \-H "Host: cvm.tencentcloudapi.com" \-H "X-TC-Action: DescribeInstances" \-H "X-TC-Timestamp: 1551113065" \-H "X-TC-Version: 2017-03-12" \-H "X-TC-Region: ap-guangzhou" \-d '{"Limit": 1, "Filters": [{"Values": ["unnamed"], "Name": "instance-name"}]}'The signature calculation process is explained in detail below.

1. Concatenating the CanonicalRequest String
Concatenate the canonical request string (CanonicalRequest) in the following pseudocode format:
CanonicalRequest =HTTPRequestMethod + '\n' +CanonicalURI + '\n' +©2013-2022 Tencent Cloud. All rights reserved.

Page 24 of 190

TencentDB for MongoDB

CanonicalQueryString + '\n' +CanonicalHeaders + '\n' +SignedHeaders + '\n' +HashedRequestPayload
Field Name

Explanation

HTTPRequestMethod

HTTP request method (GET or POST). This example uses POST .

CanonicalURI

URI parameter. Slash ("/") is used for API 3.0.
The query string in the URL of the originating HTTP request. This is always an empty st“” for POST requests, and is the string after the question mark (?) for GET requests. Fo

CanonicalQueryString。

example: Limit=10&Offset=0
Note: CanonicalQueryString must be URL-encoded, referencing RFC3986, theUTF8 character set. We recommend using the programming language library. All specia
characters must be encoded and capitalized.
Header information for signature calculation, including at least two headers of host
content-type . Custom headers can be added to participate in the signature proce
improve the uniqueness and security of the request.
Concatenation rules:
1. Both the key and value of the header should be converted to lowercase with the lead

CanonicalHeaders

and trailing spaces removed, so they are concatenated in the format of key:value\nformat;2. If there are multiple headers, they should be sorted in ASCII ascending order by theheader keys (lowercase).
The calculation result in this example is content-type:application/json;
charset=utf-8\nhost:cvm.tencentcloudapi.com\n .
Note: content-type must match the actually sent content. In some programming
languages, a charset value would be added even if it is not specified. In this case, therequest sent is different from the one signed, and the sever will return an error indicating
signature verification failed.
Header information for signature calculation, indicating which headers of the request
participate in the signature process (they must each individually correspond to the headin CanonicalHeaders). Content-type and host are required headers.

SignedHeaders

Concatenation rules:
1. Both the key and value of the header should be converted to lowercase;
2. If there are multiple headers, they should be sorted in ASCII ascending order by theheader keys (lowercase) and separated by semicolons (;).
The value in this example is content-type;hostHashedRequestPayload

Hash value of the request payload (i.e., the body, such as {"Limit": 1, "Filter©2013-2022 Tencent Cloud. All rights reserved.

Page 25 of 190

TencentDB for MongoDB[{"Values": ["unnamed"], "Name": "instance-name"}]} in this example
The pseudocode for calculation is
Lowercase(HexEncode(Hash.SHA256(RequestPayload))) by SHA256 hashing the payof the HTTP request, performing hexadecimal encoding, and finally converting the enco
string to lowercase letters. For GET requests, RequestPayload is always an empt
string. The calculation result in this example is
99d58dfbc6745f6747f36bfca17dee5e6881dc0428a0a36f96199342bc5b49

According to the rules above, the CanonicalRequest string obtained in the example is as follows:

POST/
content-type:application/json; charset=utf-8
host:cvm.tencentcloudapi.com
content-type;host
99d58dfbc6745f6747f36bfca17dee5e6881dc0428a0a36f96199342bc5b4907

2. Concatenating the String to Be Signed
The string to sign is concatenated as follows:
StringToSign =Algorithm + \n +RequestTimestamp + \n +CredentialScope + \n +HashedCanonicalRequest
Field Name

Explanation

Algorithm

Signature algorithm, which is currently always TC3-HMAC-SHA256 .
Request timestamp, i.e., the value of the common parameter X-TC-Timestamp in

RequestTimestamp

request header, which is the UNIX timestamp of the current time in seconds, such as1551113065 in this example.
Scope of the credential in the format of Date/service/tc3_request , including
date, requested service and termination string (tc3_request). Date is a date in UT

CredentialScopetime, whose value should match the UTC date converted by the common
parameter X-TC-Timestamp ; service is the product name, which should mthe domain name of the product called. The calculation result in this example is 201
25/cvm/tc3_request .

©2013-2022 Tencent Cloud. All rights reserved.

Page 26 of 190

TencentDB for MongoDB

HashedCanonicalRequest

Hash value of the CanonicalRequest string concatenated in the steps above. The
pseudocode for calculation is Lowercase(HexEncode(Hash.SHA256(CanonicalRequ
The calculation result in this example is2815843035062fffda5fd6f2a44ea8a34818b0dc46f024b8b3786976a3ad

Note:

1. Date has to be calculated from the timestamp "X-TC-Timestamp" and the time zone is UTC+0. If you add
the system's local time zone information (such as UTC+8), calls can succeed both day and night but willdefinitely fail at 00:00. For example, if the timestamp is 1551113065 and the time in UTC+8 is 2019-02-26
00:44:25, the UTC+0 date in the calculated Date value should be 2019-02-25 instead of 2019-02-26.
2. Timestamp must be the same as your current system time, and your system time and standard time must be
synced; if the difference between Timestamp and your current system time is larger than five minutes, therequest will fail. If your system time is out of sync with the standard time for a while, the request will fail andreturn a signature expiration error.

According to the preceding rules, the string to be signed obtained in the example is as follows:
TC3-HMAC-SHA256
1551113065
2019-02-25/cvm/tc3_request
2815843035062fffda5fd6f2a44ea8a34818b0dc46f024b8b3786976a3adda7a

3. Calculating the Signature
1) Calculate the derived signature key with the following pseudocode:

SecretKey = "Gu5t9xGARNpq86cd98joQYCN3*******"
SecretDate = HMAC_SHA256("TC3" + SecretKey, Date)
SecretService = HMAC_SHA256(SecretDate, Service)
SecretSigning = HMAC_SHA256(SecretService, "tc3_request")
Field Name

Explanation

SecretKey

The original SecretKey, i.e., Gu5t9xGARNpq86cd98joQYCN3******* .

Date

The Date field information in Credential , such as 2019-02-25 in this example.

Service

Value in the Service field in Credential , such as cvm in this example.

©2013-2022 Tencent Cloud. All rights reserved.

Page 27 of 190

TencentDB for MongoDB

2) Calculate the signature with the following pseudocode:
Signature = HexEncode(HMAC_SHA256(SecretSigning, StringToSign))

4. Concatenating the Authorization
The Authorization is concatenated as follows:

Authorization =Algorithm + ' ' +'Credential=' + SecretId + '/' + CredentialScope + ', ' +'SignedHeaders=' + SignedHeaders + ', ' +'Signature=' + Signature
Field Name

Explanation

Algorithm

Signature algorithm, which is always TC3-HMAC-SHA256 .

SecretId

The SecretId in the key pair, i.e., AKIDz8krbsJ5yKBZQpn74WFkmLPx3******* .

CredentialScope

SignedHeadersSignature

Credential scope (see above). The calculation result in this example is 2019-0225/cvm/tc3_request .
Header information for signature calculation (see above), such as content-type;hostin this example.
Signature value. The calculation result in this example isc492e8e41437e97a620b728c301bb8d17e7dc0c17eeabce80c20cd70fc3a78ff .

According to the rules above, the value obtained in the example is:TC3-HMAC-SHA256 Credential=AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******/2019-02-25/cvm/tc
3_request, SignedHeaders=content-type;host, Signature=c492e8e41437e97a620b728c301
bb8d17e7dc0c17eeabce80c20cd70fc3a78ff
The following example shows a finished authorization header:
POST https://cvm.tencentcloudapi.com/
Authorization: TC3-HMAC-SHA256 Credential=AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******/20
19-02-25/cvm/tc3_request, SignedHeaders=content-type;host, Signature=c492e8e41437
e97a620b728c301bb8d17e7dc0c17eeabce80c20cd70fc3a78ff
Content-Type: application/json; charset=utf-8
Host: cvm.tencentcloudapi.com©2013-2022 Tencent Cloud. All rights reserved.

Page 28 of 190

TencentDB for MongoDB

X-TC-Action: DescribeInstances
X-TC-Version: 2017-03-12
X-TC-Timestamp: 1551113065
X-TC-Region: ap-guangzhou{"Limit": 1, "Filters": [{"Values": ["unnamed"], "Name": "instance-name"}]}5. Signature Demo
When calling API 3.0, you are recommended to use the corresponding Tencent Cloud SDK 3.0 which encapsulates
the signature process, enabling you to focus on only the specific APIs provided by the product when developing. See
SDK Center for more information. Currently, the following programming languages are supported:
PythonJava
PHP
Go
NodeJS.NET
To further explain the signing process, we will use a programming language to implement the process describedabove. The request domain name, API and parameter values in the sample are used here. This goal of this example isonly to provide additional clarification for the signature process, please see the SDK for actual usage.
The final output URL might be: https://cvm.tencentcloudapi.com/?Action=DescribeInstances&InstanceIds.0=ins09dx96dg&Limit=20&Nonce=11886&Offset=0&Region=apguangzhou&SecretId=AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******&Signature=EliP9YW3pW28FpsEdkXt%2F%2B
WcGeI%3D&Timestamp=1465185768&Version=2017-03-12.
Note: The key in the example is fictitious, and the timestamp is not the current time of the system, so if this URL is
opened in the browser or called using commands such as curl, an authentication error will be returned: Signature
expired. In order to get a URL that can work properly, you need to replace the SecretId and SecretKey in the example
with your real credentials and use the current time of the system as the Timestamp.
Note: In the example below, even if you use the same programming language, the order of the parameters in the URL
may be different for each execution. However, the order does not matter, as long as all the parameters are included in
the URL and the signature is calculated correctly.
Note: The following code is only applicable to API 3.0. It cannot be directly used in other signature processes. Even
with an older API, signature calculation errors may occur due to the differences in details. Please refer to thecorresponding documentation.
Java©2013-2022 Tencent Cloud. All rights reserved.

Page 29 of 190

TencentDB for MongoDB

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import java.util.TreeMap;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.bind.DatatypeConverter;
public class TencentCloudAPITC3Demo {private final static Charset UTF8 = StandardCharsets.UTF_8;
private final static String SECRET_ID = "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******";
private final static String SECRET_KEY = "Gu5t9xGARNpq86cd98joQYCN3*******";
private final static String CT_JSON = "application/json; charset=utf-8";
public static byte[] hmac256(byte[] key, String msg) throws Exception {Mac mac = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKeySpec = new SecretKeySpec(key, mac.getAlgorithm());
mac.init(secretKeySpec);
return mac.doFinal(msg.getBytes(UTF8));}
public static String sha256Hex(String s) throws Exception {MessageDigest md = MessageDigest.getInstance("SHA-256");
byte[] d = md.digest(s.getBytes(UTF8));
return DatatypeConverter.printHexBinary(d).toLowerCase();}public static void main(String[] args) throws Exception {String service = "cvm";
String host = "cvm.tencentcloudapi.com";
String region = "ap-guangzhou";String action = "DescribeInstances";
String version = "2017-03-12";
String algorithm = "TC3-HMAC-SHA256";
String timestamp = "1551113065";//String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");// Pay attention to the time zone; otherwise, errors may occur
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String date = sdf.format(new Date(Long.valueOf(timestamp + "000")));// ************* Step 1: Concatenate the CanonicalRequest string *************
String httpRequestMethod = "POST";©2013-2022 Tencent Cloud. All rights reserved.

Page 30 of 190

TencentDB for MongoDB

String canonicalUri = "/";
String canonicalQueryString = "";String canonicalHeaders = "content-type:application/json; charset=utf-8\n" + "host:" + host + "\n";String signedHeaders = "content-type;host";
String payload = "{\"Limit\": 1, \"Filters\": [{\"Values\": [\"unnamed\"], \"Name\": \"instance-name\"}]}";
String hashedRequestPayload = sha256Hex(payload);
String canonicalRequest = httpRequestMethod + "\n" + canonicalUri + "\n" + canoni
calQueryString + "\n"+ canonicalHeaders + "\n" + signedHeaders + "\n" + hashedRequestPayload;
System.out.println(canonicalRequest);// ************* Step 2: Concatenate the string to sign *************
String credentialScope = date + "/" + service + "/" + "tc3_request";
String hashedCanonicalRequest = sha256Hex(canonicalRequest);
String stringToSign = algorithm + "\n" + timestamp + "\n" + credentialScope +"\n" + hashedCanonicalRequest;
System.out.println(stringToSign);// ************* Step 3: Calculate the signature *************
byte[] secretDate = hmac256(("TC3" + SECRET_KEY).getBytes(UTF8), date);byte[] secretService = hmac256(secretDate, service);byte[] secretSigning = hmac256(secretService, "tc3_request");String signature = DatatypeConverter.printHexBinary(hmac256(secretSigning, string
ToSign)).toLowerCase();
System.out.println(signature);// ************* Step 4: Concatenate the Authorization *************
String authorization = algorithm + " " + "Credential=" + SECRET_ID + "/" + creden
tialScope + ", "+ "SignedHeaders=" + signedHeaders + ", " + "Signature=" + signature;
System.out.println(authorization);
TreeMap<String, String> headers = new TreeMap<String, String>();headers.put("Authorization", authorization);headers.put("Content-Type", CT_JSON);headers.put("Host", host);
headers.put("X-TC-Action", action);headers.put("X-TC-Timestamp", timestamp);
headers.put("X-TC-Version", version);headers.put("X-TC-Region", region);
StringBuilder sb = new StringBuilder();sb.append("curl -X POST https://").append(host).append(" -H \"Authorization: ").append(authorization).append("\"")©2013-2022 Tencent Cloud. All rights reserved.

Page 31 of 190

TencentDB for MongoDB.append(" -H \"Content-Type: application/json; charset=utf-8\"").append(" -H \"Host: ").append(host).append("\"").append(" -H \"X-TC-Action: ").append(action).append("\"").append(" -H \"X-TC-Timestamp: ").append(timestamp).append("\"").append(" -H \"X-TC-Version: ").append(version).append("\"").append(" -H \"X-TC-Region: ").append(region).append("\"").append(" -d '").append(payload).append("'");
System.out.println(sb.toString());}}

Python# -*- coding: utf-8 -*import hashlib, hmac, json, os, sys, timefrom datetime import datetime# Key Parameters
secret_id = "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******"
secret_key = "Gu5t9xGARNpq86cd98joQYCN3*******"
service = "cvm"host = "cvm.tencentcloudapi.com"
endpoint = "https://" + hostregion = "ap-guangzhou"
action = "DescribeInstances"version = "2017-03-12"
algorithm = "TC3-HMAC-SHA256"#timestamp = int(time.time())
timestamp = 1551113065
date = datetime.utcfromtimestamp(timestamp).strftime("%Y-%m-%d")params = {"Limit": 1, "Filters": [{"Name": "instance-name", "Values": ["unnamed"]}]}# ************* Step 1: Concatenate the CanonicalRequest string *************
http_request_method = "POST"
canonical_uri = "/"canonical_querystring = ""ct = "application/json; charset=utf-8"
payload = json.dumps(params)
canonical_headers = "content-type:%s\nhost:%s\n" % (ct, host)signed_headers = "content-type;host"hashed_request_payload = hashlib.sha256(payload.encode("utf-8")).hexdigest()
canonical_request = (http_request_method + "\n" +canonical_uri + "\n" +canonical_querystring + "\n" +©2013-2022 Tencent Cloud. All rights reserved.

Page 32 of 190

TencentDB for MongoDB

canonical_headers + "\n" +signed_headers + "\n" +hashed_request_payload)
print(canonical_request)# ************* Step 2: Concatenate the string to sign *************
credential_scope = date + "/" + service + "/" + "tc3_request"
hashed_canonical_request = hashlib.sha256(canonical_request.encode("utf-8")).hexd
igest()
string_to_sign = (algorithm + "\n" +str(timestamp) + "\n" +credential_scope + "\n" +hashed_canonical_request)
print(string_to_sign)# ************* Step 3: Calculate the Signature *************# Function for computing signature digest
def sign(key, msg):
return hmac.new(key, msg.encode("utf-8"), hashlib.sha256).digest()
secret_date = sign(("TC3" + secret_key).encode("utf-8"), date)secret_service = sign(secret_date, service)secret_signing = sign(secret_service, "tc3_request")
signature = hmac.new(secret_signing, string_to_sign.encode("utf-8"), hashlib.sha256).hexdigest()
print(signature)# ************* Step 4: Concatenate the Authorization *************
authorization = (algorithm + " " +"Credential=" + secret_id + "/" + credential_scope + ", " +"SignedHeaders=" + signed_headers + ", " +"Signature=" + signature)
print(authorization)
print('curl -X POST ' + endpoint+ ' -H "Authorization: ' + authorization + '"'+ ' -H "Content-Type: application/json; charset=utf-8"'+ ' -H "Host: ' + host + '"'+ ' -H "X-TC-Action: ' + action + '"'+ ' -H "X-TC-Timestamp: ' + str(timestamp) + '"'+ ' -H "X-TC-Version: ' + version + '"'+ ' -H "X-TC-Region: ' + region + '"'+ " -d '" + payload + "'")

Golang©2013-2022 Tencent Cloud. All rights reserved.

Page 33 of 190

TencentDB for MongoDB

package main
import ("crypto/hmac""crypto/sha256""encoding/hex""fmt""time")
func sha256hex(s string) string {b := sha256.Sum256([]byte(s))
return hex.EncodeToString(b[:])}func hmacsha256(s, key string) string {hashed := hmac.New(sha256.New, []byte(key))hashed.Write([]byte(s))
return string(hashed.Sum(nil))}func main() {secretId := "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******"
secretKey := "Gu5t9xGARNpq86cd98joQYCN3*******"
host := "cvm.tencentcloudapi.com"
algorithm := "TC3-HMAC-SHA256"
service := "cvm"version := "2017-03-12"
action := "DescribeInstances"
region := "ap-guangzhou"//var timestamp int64 = time.Now().Unix()
var timestamp int64 = 1551113065// step 1: build canonical request string
httpRequestMethod := "POST"
canonicalURI := "/"canonicalQueryString := ""canonicalHeaders := "content-type:application/json; charset=utf-8\n" + "host:" +host + "\n"signedHeaders := "content-type;host"
payload := `{"Limit": 1, "Filters": [{"Values": ["unnamed"], "Name": "instance-name"}]}`
hashedRequestPayload := sha256hex(payload)
canonicalRequest := fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s",
httpRequestMethod,
canonicalURI,©2013-2022 Tencent Cloud. All rights reserved.

Page 34 of 190

TencentDB for MongoDB

canonicalQueryString,canonicalHeaders,signedHeaders,hashedRequestPayload)
fmt.Println(canonicalRequest)// step 2: build string to sign
date := time.Unix(timestamp, 0).UTC().Format("2006-01-02")
credentialScope := fmt.Sprintf("%s/%s/tc3_request", date, service)hashedCanonicalRequest := sha256hex(canonicalRequest)
string2sign := fmt.Sprintf("%s\n%d\n%s\n%s",
algorithm,
timestamp,
credentialScope,
hashedCanonicalRequest)
fmt.Println(string2sign)// step 3: sign string
secretDate := hmacsha256(date, "TC3"+secretKey)
secretService := hmacsha256(service, secretDate)secretSigning := hmacsha256("tc3_request", secretService)signature := hex.EncodeToString([]byte(hmacsha256(string2sign, secretSigning)))
fmt.Println(signature)// step 4: build authorization
authorization := fmt.Sprintf("%s Credential=%s/%s, SignedHeaders=%s, Signature=%s",algorithm,
secretId,
credentialScope,
signedHeaders,signature)
fmt.Println(authorization)
curl := fmt.Sprintf(`curl -X POST https://%s\-H "Authorization: %s"\
-H "Content-Type: application/json; charset=utf-8"\-H "Host: %s" -H "X-TC-Action: %s"\
-H "X-TC-Timestamp: %d"\
-H "X-TC-Version: %s"\
-H "X-TC-Region: %s"\-d '%s'`, host, authorization, host, action, timestamp, version, region, payload)
fmt.Println(curl)}

PHP©2013-2022 Tencent Cloud. All rights reserved.

Page 35 of 190

TencentDB for MongoDB<?php$secretId = "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******";$secretKey = "Gu5t9xGARNpq86cd98joQYCN3*******";$host = "cvm.tencentcloudapi.com";$service = "cvm";$version = "2017-03-12";$action = "DescribeInstances";$region = "ap-guangzhou";// $timestamp = time();$timestamp = 1551113065;$algorithm = "TC3-HMAC-SHA256";// step 1: build canonical request string$httpRequestMethod = "POST";$canonicalUri = "/";
$canonicalQueryString = "";$canonicalHeaders = "content-type:application/json; charset=utf-8\n"."host:".$host."\n";$signedHeaders = "content-type;host";$payload = '{"Limit": 1, "Filters": [{"Values": ["unnamed"], "Name": "instance-name"}]}';$hashedRequestPayload = hash("SHA256", $payload);$canonicalRequest = $httpRequestMethod."\n".$canonicalUri."\n".$canonicalQueryString."\n".$canonicalHeaders."\n".$signedHeaders."\n".$hashedRequestPayload;
echo $canonicalRequest.PHP_EOL;// step 2: build string to sign
$date = gmdate("Y-m-d", $timestamp);$credentialScope = $date."/".$service."/tc3_request";$hashedCanonicalRequest = hash("SHA256", $canonicalRequest);$stringToSign = $algorithm."\n".$timestamp."\n".$credentialScope."\n".$hashedCanonicalRequest;
echo $stringToSign.PHP_EOL;// step 3: sign string$secretDate = hash_hmac("SHA256", $date, "TC3".$secretKey, true);$secretService = hash_hmac("SHA256", $service, $secretDate, true);$secretSigning = hash_hmac("SHA256", "tc3_request", $secretService, true);$signature = hash_hmac("SHA256", $stringToSign, $secretSigning);
echo $signature.PHP_EOL;©2013-2022 Tencent Cloud. All rights reserved.

Page 36 of 190

TencentDB for MongoDB// step 4: build authorization$authorization = $algorithm." Credential=".$secretId."/".$credentialScope.", SignedHeaders=content-type;host, Signature=".$signature;echo $authorization.PHP_EOL;$curl = "curl -X POST https://".$host.' -H "Authorization: '.$authorization.'"'.' -H "Content-Type: application/json; charset=utf-8"'.' -H "Host: '.$host.'"'.' -H "X-TC-Action: '.$action.'"'.' -H "X-TC-Timestamp: '.$timestamp.'"'.' -H "X-TC-Version: '.$version.'"'.' -H "X-TC-Region: '.$region.'"'." -d '".$payload."'";
echo $curl.PHP_EOL;

Ruby# -*- coding: UTF-8 -*# require ruby>=2.3.0
require 'digest'
require 'json'
require 'time'require 'openssl'# Key Parameters
secret_id = 'AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******'
secret_key = 'Gu5t9xGARNpq86cd98joQYCN3*******'
service = 'cvm'
host = 'cvm.tencentcloudapi.com'
endpoint = 'https://' + hostregion = 'ap-guangzhou'
action = 'DescribeInstances'version = '2017-03-12'
algorithm = 'TC3-HMAC-SHA256'# timestamp = Time.now.to_i
timestamp = 1551113065
date = Time.at(timestamp).utc.strftime('%Y-%m-%d')# ************* Step 1: Concatenate the CanonicalRequest string *************
http_request_method = 'POST'
canonical_uri = '/'canonical_querystring = ''©2013-2022 Tencent Cloud. All rights reserved.

Page 37 of 190

TencentDB for MongoDB

canonical_headers = "content-type:application/json; charset=utf-8\nhost:#{host}\n"signed_headers = 'content-type;host'# params = { 'Limit' => 1, 'Filters' => [{ 'Name' => 'instance-name', 'Values' =>['unnamed'] }] }# payload = JSON.generate(params, { 'ascii_only' => true, 'space' => ' ' })# json will generate in random order, to get specified result in example, we hard-code it here.
payload = '{"Limit": 1, "Filters": [{"Values": ["unnamed"], "Name": "instance-name"}]}'
hashed_request_payload = Digest::SHA256.hexdigest(payload)
canonical_request = [http_request_method,
canonical_uri,canonical_querystring,canonical_headers,signed_headers,hashed_request_payload,].join("\n")puts canonical_request# ************* Step 2: Concatenate the string to sign *************
credential_scope = date + '/' + service + '/' + 'tc3_request'
hashed_request_payload = Digest::SHA256.hexdigest(canonical_request)
string_to_sign = [algorithm,
timestamp.to_s,
credential_scope,
hashed_request_payload,].join("\n")puts string_to_sign# ************* Step 3: Calculate the Signature *************
digest = OpenSSL::Digest.new('sha256')secret_date = OpenSSL::HMAC.digest(digest, 'TC3' + secret_key, date)secret_service = OpenSSL::HMAC.digest(digest, secret_date, service)secret_signing = OpenSSL::HMAC.digest(digest, secret_service, 'tc3_request')
signature = OpenSSL::HMAC.hexdigest(digest, secret_signing, string_to_sign)
puts signature# ************* Step 4: Concatenate the Authorization *************
authorization = "#{algorithm} Credential=#{secret_id}/#{credential_scope}, Signed
Headers=#{signed_headers}, Signature=#{signature}"puts authorization
puts 'curl -X POST ' + endpoint \©2013-2022 Tencent Cloud. All rights reserved.

Page 38 of 190

TencentDB for MongoDB+ ' -H "Authorization: ' + authorization + '"' \+ ' -H "Content-Type: application/json; charset=utf-8"' \+ ' -H "Host: ' + host + '"' \+ ' -H "X-TC-Action: ' + action + '"' \+ ' -H "X-TC-Timestamp: ' + timestamp.to_s + '"' \+ ' -H "X-TC-Version: ' + version + '"' \+ ' -H "X-TC-Region: ' + region + '"' \+ " -d '" + payload + "'"DotNetusing System;
using System.Collections.Generic;using System.Security.Cryptography;
using System.Text;
public class Application{
public static string SHA256Hex(string s){
using (SHA256 algo = SHA256.Create()){
byte[] hashbytes = algo.ComputeHash(Encoding.UTF8.GetBytes(s));
StringBuilder builder = new StringBuilder();for (int i = 0; i < hashbytes.Length; ++i){
builder.Append(hashbytes[i].ToString("x2"));}
return builder.ToString();}}
public static byte[] HmacSHA256(byte[] key, byte[] msg){
using (HMACSHA256 mac = new HMACSHA256(key)){
return mac.ComputeHash(msg);}}
public static Dictionary<String, String> BuildHeaders(string secretid,
string secretkey, string service, string endpoint, string region,
string action, string version, DateTime date, string requestPayload){
string datestr = date.ToString("yyyy-MM-dd");
DateTime startTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
long requestTimestamp = (long)Math.Round((date - startTime).TotalMilliseconds, Mi©2013-2022 Tencent Cloud. All rights reserved.

Page 39 of 190

TencentDB for MongoDB

dpointRounding.AwayFromZero) / 1000;// ************* Step 1: Concatenate the CanonicalRequest string *************
string algorithm = "TC3-HMAC-SHA256";
string httpRequestMethod = "POST";
string canonicalUri = "/";
string canonicalQueryString = "";string contentType = "application/json";string canonicalHeaders = "content-type:" + contentType + "; charset=utf-8\n" +"host:" + endpoint + "\n";string signedHeaders = "content-type;host";
string hashedRequestPayload = SHA256Hex(requestPayload);string canonicalRequest = httpRequestMethod + "\n"+ canonicalUri + "\n"+ canonicalQueryString + "\n"+ canonicalHeaders + "\n"+ signedHeaders + "\n"+ hashedRequestPayload;
Console.WriteLine(canonicalRequest);
Console.WriteLine("----------------------------------");// ************ Step 2: Concatenate the string to sign *************
string credentialScope = datestr + "/" + service + "/" + "tc3_request";
string hashedCanonicalRequest = SHA256Hex(canonicalRequest);
string stringToSign = algorithm + "\n" + requestTimestamp.ToString() + "\n" + cre
dentialScope + "\n" + hashedCanonicalRequest;
Console.WriteLine(stringToSign);
Console.WriteLine("----------------------------------");// ************* Step 3: Calculate the signature *************
byte[] tc3SecretKey = Encoding.UTF8.GetBytes("TC3" + secretkey);byte[] secretDate = HmacSHA256(tc3SecretKey, Encoding.UTF8.GetBytes(datestr));byte[] secretService = HmacSHA256(secretDate, Encoding.UTF8.GetBytes(service));byte[] secretSigning = HmacSHA256(secretService, Encoding.UTF8.GetBytes("tc3_request"));
byte[] signatureBytes = HmacSHA256(secretSigning, Encoding.UTF8.GetBytes(stringTo
Sign));
string signature = BitConverter.ToString(signatureBytes).Replace("-", "").ToLower();
Console.WriteLine(signature);
Console.WriteLine("----------------------------------");// ************* Step 4: Concatenate the Authorization *************
string authorization = algorithm + " "+ "Credential=" + secretid + "/" + credentialScope + ", "+ "SignedHeaders=" + signedHeaders + ", "+ "Signature=" + signature;
Console.WriteLine(authorization);©2013-2022 Tencent Cloud. All rights reserved.

Page 40 of 190

TencentDB for MongoDB

Console.WriteLine("----------------------------------");
Dictionary<string, string> headers = new Dictionary<string, string>();headers.Add("Authorization", authorization);headers.Add("Host", endpoint);
headers.Add("Content-Type", contentType + "; charset=utf-8");
headers.Add("X-TC-Timestamp", requestTimestamp.ToString());
headers.Add("X-TC-Version", version);headers.Add("X-TC-Action", action);headers.Add("X-TC-Region", region);
return headers;}public static void Main(string[] args){// SecretID and SecretKey
string SECRET_ID = "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******";
string SECRET_KEY = "Gu5t9xGARNpq86cd98joQYCN3*******";
string service = "cvm";
string endpoint = "cvm.tencentcloudapi.com";string region = "ap-guangzhou";string action = "DescribeInstances";
string version = "2017-03-12";// The timestamp `2019-02-26 00:44:25` used here is only for reference. In a proj
ect, use the following parameter:// DateTime date = DateTime.UtcNow;// Enter the correct time zone. We recommend using UTC timestamp to avoid errors.
DateTime date = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(1551113065);
string requestPayload = "{\"Limit\": 1, \"Filters\": [{\"Values\": [\"\\u672a\\u5
47d\\u540d\"], \"Name\": \"instance-name\"}]}";
Dictionary<string, string> headers = BuildHeaders(SECRET_ID, SECRET_KEY, service, endpoint, region, action, version, date, requestPayload);
Console.WriteLine("POST https://cvm.tencentcloudapi.com");foreach (KeyValuePair<string, string> kv in headers){Console.WriteLine(kv.Key + ": " + kv.Value);}
Console.WriteLine();Console.WriteLine(requestPayload);}}©2013-2022 Tencent Cloud. All rights reserved.

Page 41 of 190

TencentDB for MongoDB

NodeJS
const crypto = require('crypto');function sha256(message, secret = '', encoding) {const hmac = crypto.createHmac('sha256', secret)return hmac.update(message).digest(encoding)}
function getHash(message, encoding = 'hex') {const hash = crypto.createHash('sha256')
return hash.update(message).digest(encoding)}
function getDate(timestamp) {const date = new Date(timestamp * 1000)
const year = date.getUTCFullYear()const month = ('0' + (date.getUTCMonth() + 1)).slice(-2)
const day = ('0' + date.getUTCDate()).slice(-2)
return `${year}-${month}-${day}`}function main(){const SECRET_ID = "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******"
const SECRET_KEY = "Gu5t9xGARNpq86cd98joQYCN3*******"
const endpoint = "cvm.tencentcloudapi.com"
const service = "cvm"
const region = "ap-guangzhou"
const action = "DescribeInstances"
const version = "2017-03-12"//const timestamp = getTime()
const timestamp = 1551113065
const date = getDate(timestamp)// ************* Step 1: Concatenate the CanonicalRequest string *************
const signedHeaders = "content-type;host"const payload = "{\"Limit\": 1, \"Filters\": [{\"Values\": [\"unnamed\"], \"Name\": \"instance-name\"}]}"
const hashedRequestPayload = getHash(payload);
const httpRequestMethod = "POST"
const canonicalUri = "/"const canonicalQueryString = ""const canonicalHeaders = "content-type:application/json; charset=utf-8\n" + "host:" + endpoint + "\n"const canonicalRequest = httpRequestMethod + "\n"©2013-2022 Tencent Cloud. All rights reserved.

Page 42 of 190

TencentDB for MongoDB+ canonicalUri + "\n"+ canonicalQueryString + "\n"+ canonicalHeaders + "\n"+ signedHeaders + "\n"+ hashedRequestPayload
console.log(canonicalRequest)
console.log("----------------------------")// ************* Step 2: Concatenate the string to sign *************
const algorithm = "TC3-HMAC-SHA256"
const hashedCanonicalRequest = getHash(canonicalRequest);
const credentialScope = date + "/" + service + "/" + "tc3_request"
const stringToSign = algorithm + "\n" +timestamp + "\n" +credentialScope + "\n" +hashedCanonicalRequest
console.log(stringToSign)
console.log("----------------------------")// ************* Step 3: Calculate the signature *************
const kDate = sha256(date, 'TC3' + SECRET_KEY)
const kService = sha256(service, kDate)
const kSigning = sha256('tc3_request', kService)
const signature = sha256(stringToSign, kSigning, 'hex')
console.log(signature)
console.log("----------------------------")// ************* Step 4: Concatenate the Authorization *************
const authorization = algorithm + " " +"Credential=" + SECRET_ID + "/" + credentialScope + ", " +"SignedHeaders=" + signedHeaders + ", " +"Signature=" + signature
console.log(authorization)
console.log("----------------------------")
const Call_Information = 'curl -X POST ' + "https://" + endpoint+ ' -H "Authorization: ' + authorization + '"'+ ' -H "Content-Type: application/json; charset=utf-8"'+ ' -H "Host: ' + endpoint + '"'+ ' -H "X-TC-Action: ' + action + '"'+ ' -H "X-TC-Timestamp: ' + timestamp.toString() + '"'+ ' -H "X-TC-Version: ' + version + '"'+ ' -H "X-TC-Region: ' + region + '"'+ " -d '" + payload + "'"console.log(Call_Information)}main()©2013-2022 Tencent Cloud. All rights reserved.

Page 43 of 190

TencentDB for MongoDB

C++#include <iostream>#include <iomanip>#include <sstream>#include <string>#include <stdio.h>#include <time.h>#include <openssl/sha.h>#include <openssl/hmac.h>using namespace std;
string get_data(int64_t &timestamp){
string utcDate;char buff[20] = {0};// time_t timenow;
struct tm sttime;
sttime = *gmtime(&timestamp);
strftime(buff, sizeof(buff), "%Y-%m-%d", &sttime);
utcDate = string(buff);
return utcDate;}string int2str(int64_t n){
std::stringstream ss;
ss << n;return ss.str();}string sha256Hex(const string &str){
char buf[3];unsigned char hash[SHA256_DIGEST_LENGTH];
SHA256_CTX sha256;
SHA256_Init(&sha256);
SHA256_Update(&sha256, str.c_str(), str.size());
SHA256_Final(hash, &sha256);
std::string NewString = "";for(int i = 0; i < SHA256_DIGEST_LENGTH; i++){snprintf(buf, sizeof(buf), "%02x", hash[i]);NewString = NewString + buf;}
return NewString;©2013-2022 Tencent Cloud. All rights reserved.

Page 44 of 190

TencentDB for MongoDB}
string HmacSha256(const string &key, const string &input){
unsigned char hash[32];
HMAC_CTX *h;#if OPENSSL_VERSION_NUMBER < 0x10100000L
HMAC_CTX hmac;
HMAC_CTX_init(&hmac);h = &hmac;#else
h = HMAC_CTX_new();#endif
HMAC_Init_ex(h, &key[0], key.length(), EVP_sha256(), NULL);
HMAC_Update(h, ( unsigned char* )&input[0], input.length());
unsigned int len = 32;
HMAC_Final(h, hash, &len);#if OPENSSL_VERSION_NUMBER < 0x10100000L
HMAC_CTX_cleanup(h);#else
HMAC_CTX_free(h);#endif
std::stringstream ss;
ss << std::setfill('0');for (int i = 0; i < len; i++){ss << hash[i];}return (ss.str());}
string HexEncode(const string &input){
static const char* const lut = "0123456789abcdef";
size_t len = input.length();string output;
output.reserve(2 * len);for (size_t i = 0; i < len; ++i){
const unsigned char c = input[i];output.push_back(lut[c >> 4]);
output.push_back(lut[c & 15]);}©2013-2022 Tencent Cloud. All rights reserved.

Page 45 of 190

TencentDB for MongoDB

return output;}
int main(){string SECRET_ID = "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******";
string SECRET_KEY = "Gu5t9xGARNpq86cd98joQYCN3*******";
string service = "cvm";
string host = "cvm.tencentcloudapi.com";string region = "ap-guangzhou";string action = "DescribeInstances";
string version = "2017-03-12";
int64_t timestamp = 1551113065;
string date = get_data(timestamp);// ************* Step 1: Concatenate the CanonicalRequest string *************
string httpRequestMethod = "POST";
string canonicalUri = "/";
string canonicalQueryString = "";string canonicalHeaders = "content-type:application/json; charset=utf-8\nhost:" +host + "\n";string signedHeaders = "content-type;host";
string payload = "{\"Limit\": 1, \"Filters\": [{\"Values\": [\"unnamed\"], \"Name\": \"instance-name\"}]}";
string hashedRequestPayload = sha256Hex(payload);string canonicalRequest = httpRequestMethod + "\n" + canonicalUri + "\n" + canoni
calQueryString + "\n"+ canonicalHeaders + "\n" + signedHeaders + "\n" + hashedRequestPayload;cout << canonicalRequest << endl;
cout << "-----------------------" << endl;// ************* Step 2: Concatenate the string to sign *************
string algorithm = "TC3-HMAC-SHA256";
string RequestTimestamp = int2str(timestamp);
string credentialScope = date + "/" + service + "/" + "tc3_request";
string hashedCanonicalRequest = sha256Hex(canonicalRequest);
string stringToSign = algorithm + "\n" + RequestTimestamp + "\n" + credentialScop
e + "\n" + hashedCanonicalRequest;
cout << stringToSign << endl;
cout << "-----------------------" << endl;// ************* Step 3: Calculate the signature ***************
string kKey = "TC3" + SECRET_KEY;
string kDate = HmacSha256(kKey, date);
string kService = HmacSha256(kDate, service);
string kSigning = HmacSha256(kService, "tc3_request");©2013-2022 Tencent Cloud. All rights reserved.

Page 46 of 190

TencentDB for MongoDB

string signature = HexEncode(HmacSha256(kSigning, stringToSign));cout << signature << endl;
cout << "-----------------------" << endl;// ************* Step 4: Concatenate the Authorization *************
string authorization = algorithm + " " + "Credential=" + SECRET_ID + "/" + creden
tialScope + ", "+ "SignedHeaders=" + signedHeaders + ", " + "Signature=" + signature;cout << authorization << endl;
cout << "------------------------" << endl;
string headers = "curl -X POST https://" + host + "\n"+ " -H \"Authorization: " + authorization + "\n"+ " -H \"Content-Type: application/json; charset=utf-8\"" + "\n"+ " -H \"Host: " + host + "\n"+ " -H \"X-TC-Action: " + action + "\n"+ " -H \"X-TC-Timestamp: " + RequestTimestamp + "\n"+ " -H \"X-TC-Version: " + version + "\n"+ " -H \"X-TC-Region: " + region + "\n"+ " -d '" + payload;cout << headers << endl;
return 0;};

Signature Failure
The following situational error codes for signature failure may occur. Please resolve the errors accordingly.
Error CodeDescription

AuthFailure.SignatureExpire

Signature expired. Timestamp and server time cannot differ by more than fiveminutes.

AuthFailure.SecretIdNotFoundThe key does not exist. Please go to the console to check whether it isdisabled or you copied fewer or more characters.

AuthFailure.SignatureFailure

Signature error. It is possible that the signature was calculated incorrectly, thesignature does not match the content actually sent, or the SecretKey isincorrect.

AuthFailure.TokenFailure

Temporary certificate token error.

AuthFailure.InvalidSecretId

Invalid key (not a TencentCloud API key type).

©2013-2022 Tencent Cloud. All rights reserved.

Page 47 of 190

TencentDB for MongoDB

Signature：

Last updated 2021-08-26 14:55:02
Tencent Cloud API authenticates each access request, i.e. each request needs to include authentication information(Signature) in the common parameters to verify the identity of the requester.
The Signature is generated by the security credentials which include SecretId and SecretKey. If you don't have thesecurity credentials yet, go to the TencentCloud API Key page to apply for them; otherwise, you cannot invoke theTencentCloud API.

1. Applying for Security Credentials
Before using the TencentCloud API for the first time, go to the TencentCloud API Key page to apply for security
credentials.
Security credentials consist of SecretId and SecretKey:
SecretId is used to identify the API requester.
SecretKey is used to encrypt the signature string and verify it on the server.
You must keep your security credentials private and avoid disclosure.
You can apply for the security credentials through the following steps:
1. Log in to the Tencent Cloud Console.
2. Go to the TencentCloud API Key page.
3. On the API Key Management page, click Create Key to create a SecretId/SecretKey pair.
Note: Each account can have up to two pairs of SecretId/SecretKey.

2. Generating a SignatureWith the SecretId and SecretKey, a signature can be generated. The following describes how to generate a signature:
Assume that the SecretId and SecretKey are:SecretId: AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******
SecretKey: Gu5t9xGARNpq86cd98joQYCN3*******
Note: This is just an example. For actual operations, please use your own SecretId and SecretKey.

©2013-2022 Tencent Cloud. All rights reserved.

Page 48 of 190

TencentDB for MongoDB

Take the Cloud Virtual Machine's request to view the instance list (DescribeInstances) as an example. When you
invoke this API, the request parameters may be as follows:
Parameter
nameDescription

Parameter value

Action

Method name

DescribeInstances

SecretId

Key ID

AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******

Timestamp

Current timestamp

1465185768

Nonce

Random positive integer

11886

RegionRegion where the instance islocatedap-guangzhou

InstanceIds.0

ID of the instance to query

ins-09dx96dg

OffsetOffset0

Limit

Allowed maximum output

20

VersionAPI version number

2017-03-12

2.1. Sorting Parameters
First, sort all the request parameters in an ascending lexicographical order (ASCII code) by their names. Notes: (1)Parameters are sorted by their names instead of their values; (2) The parameters are sorted based on ASCII code, notin an alphabetical order or by values. For example, InstanceIds.2 should be arranged after InstanceIds.12. You cancomplete the sorting process using a sorting function in a programming language, such as the ksort function in PHP.
The parameters in the example are sorted as follows:{'Action' : 'DescribeInstances','InstanceIds.0' : 'ins-09dx96dg','Limit' : 20,'Nonce' : 11886,'Offset' : 0,
'Region' : 'ap-guangzhou','SecretId' : 'AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******','Timestamp' : 1465185768,'Version': '2017-03-12',}©2013-2022 Tencent Cloud. All rights reserved.

Page 49 of 190

TencentDB for MongoDB

When developing in another programming language, you can sort these sample parameters and it will work as long as
you obtain the same results.

2.2. Concatenating a Request String
This step generates a request string.
Format the request parameters sorted in the previous step into the form of "parameter name"="parameter value". For
example, for the Action parameter, its parameter name is "Action" and its parameter value is "DescribeInstances", so it
will become Action=DescribeInstances after formatted.
Note: The "parameter value" is the original value but not the value after URL encoding.
Then, concatenate the formatted parameters with "&". The resulting request string is as follows:

Action=DescribeInstances&InstanceIds.0=ins-09dx96dg&Limit=20&Nonce=11886&Offset=0&Region=ap-guangzhou&SecretId=AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******&Timestamp=1465
185768&Version=2017-03-12

2.3. Concatenating the Signature Original String
This step generates a signature original string.
The signature original string consists of the following parameters:
1. HTTP method: POST and GET modes are supported, and GET is used here for the request. Please note that themethod name should be in all capital letters.
2. Request server: the domain name of the request to view the list of instances (DescribeInstances) is
cvm.tencentcloudapi.com. The actual request domain name varies by the module to which the API belongs. For
more information, see the instructions of the specific API.
3. Request path: The request path in the current version of TencentCloud API is fixed to /.
4. Request string: the request string generated in the previous step.
The concatenation rule of the signature original string is: Request method + request host + request path + ? + request
string
The concatenation result of the example is:

GETcvm.tencentcloudapi.com/?Action=DescribeInstances&InstanceIds.0=ins-09dx96dg&L
imit=20&Nonce=11886&Offset=0&Region=ap-guangzhou&SecretId=AKIDz8krbsJ5yKBZQpn74WF
kmLPx3*******&Timestamp=1465185768&Version=2017-03-12

2.4. Generating a Signature String
This step generates a signature string.
First, use the HMAC-SHA1 algorithm to sign the signature original string obtained in the previous step, and then©2013-2022 Tencent Cloud. All rights reserved.

Page 50 of 190

TencentDB for MongoDB

encode the generated signature using Base64 to obtain the final signature.
The specific code is as follows with the PHP language being used as an example:$secretKey = 'Gu5t9xGARNpq86cd98joQYCN3*******';$srcStr = 'GETcvm.tencentcloudapi.com/?Action=DescribeInstances&InstanceIds.0=ins-09dx96dg&Limit=20&Nonce=11886&Offset=0&Region=ap-guangzhou&SecretId=AKIDz8krbsJ5
yKBZQpn74WFkmLPx3*******&Timestamp=1465185768&Version=2017-03-12';$signStr = base64_encode(hash_hmac('sha1', $srcStr, $secretKey, true));echo $signStr;
The final signature is:zmmjn35mikh6pM3V7sUEuX4wyYM=
When developing in another programming language, you can sign and verify the original in the example above and it
works as long as you get the same results.

3. Encoding a Signature String
The generated signature string cannot be directly used as a request parameter and must be URL encoded.
For example, if the signature string generated in the previous step is zmmjn35mikh6pM3V7sUEuX4wyYM=, the final
signature string request parameter (Signature) is zmmjn35mikh6pM3V7sUEuX4wyYM%3D, which will be used togenerate the final request URL.
Note: If your request method is GET, or the request method is POST and the Content-Type isapplication/x-www-form-urlencoded, then all the request parameter values need to be URL encoded(except the parameter key and the symbol of =) when sending the request. Non-ASCII characters need to
be encoded with UTF-8 before URL encoding.
Note: The network libraries of some programming languages automatically URL encode all parameters, inwhich case there is no need to URL encode the signature string; otherwise, two rounds of URL encoding
will cause the signature to fail.
Note: Other parameter values also need to be encoded using RFC 3986. Use %XY in percent-encoding forspecial characters such as Chinese characters, where "X" and "Y" are hexadecimal characters (0-9 anduppercase A-F), and using lowercase will cause an error.

4. Signature Failure©2013-2022 Tencent Cloud. All rights reserved.

Page 51 of 190

TencentDB for MongoDB

The following situational error codes for signature failure may occur. Please resolve the errors accordingly.
Error code

Error description

AuthFailure.SignatureExpire

The signature is expired

AuthFailure.SecretIdNotFoundThe key does not exist

AuthFailure.SignatureFailure

Signature error

AuthFailure.TokenFailure

Token error

AuthFailure.InvalidSecretId

Invalid key (not a TencentCloud API key type)

5. Signature Demo
When calling API 3.0, you are recommended to use the corresponding Tencent Cloud SDK 3.0 which encapsulates
the signature process, enabling you to focus on only the specific APIs provided by the product when developing. See
SDK Center for more information. Currently, the following programming languages are supported:
PythonJava
PHP
Go
NodeJS.NET
To further explain the signing process, we will use a programming language to implement the process describedabove. The request domain name, API and parameter values in the sample are used here. This goal of this example isonly to provide additional clarification for the signature process, please see the SDK for actual usage.
The final output URL might be: https://cvm.tencentcloudapi.com/?
Action=DescribeInstances&amp;InstanceIds.0=ins09dx96dg&amp;Limit=20&amp;Nonce=11886&amp;Offset=0&amp;Region=apguangzhou&amp;SecretId=AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******&amp;Signature=zmmjn35mik
h6pM3V7sUEuX4wyYM%3D&amp;Timestamp=1465185768&amp;Version=2017-03-12 .
Note: The key in the example is fictitious, and the timestamp is not the current time of the system, so if this URL is
opened in the browser or called using commands such as curl, an authentication error will be returned: Signature
expired. In order to get a URL that can work properly, you need to replace the SecretId and SecretKey in the example
with your real credentials and use the current time of the system as the Timestamp.

©2013-2022 Tencent Cloud. All rights reserved.

Page 52 of 190

TencentDB for MongoDB

Note: In the example below, even if you use the same programming language, the order of the parameters in the URL
may be different for each execution. However, the order does not matter, as long as all the parameters are included in
the URL and the signature is calculated correctly.
Note: The following code is only applicable to API 3.0. It cannot be directly used in other signature processes. Even
with an older API, signature calculation errors may occur due to the differences in details. Please refer to thecorresponding documentation.

Java
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;import java.util.Random;
import java.util.TreeMap;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.bind.DatatypeConverter;
public class TencentCloudAPIDemo {private final static String CHARSET = "UTF-8";
public static String sign(String s, String key, String method) throws Exception {Mac mac = Mac.getInstance(method);
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(CHARSET), mac.getAlg
orithm());
mac.init(secretKeySpec);
byte[] hash = mac.doFinal(s.getBytes(CHARSET));
return DatatypeConverter.printBase64Binary(hash);}public static String getStringToSign(TreeMap<String, Object> params) {StringBuilder s2s = new StringBuilder("GETcvm.tencentcloudapi.com/?");// When signing, the parameters need to be sorted in lexicographical order. TreeM
ap is used here to guarantee the correct order.
for (String k : params.keySet()) {s2s.append(k).append("=").append(params.get(k).toString()).append("&");}
return s2s.toString().substring(0, s2s.length() - 1);}
public static String getUrl(TreeMap<String, Object> params) throws UnsupportedEnc
odingException {StringBuilder url = new StringBuilder("https://cvm.tencentcloudapi.com/?");// There is no requirement for the order of the parameters in the actual request
URL.
for (String k : params.keySet()) {// The request string needs to be URL encoded. As the Key is all in English letters, only the value is URL encoded here.
url.append(k).append("=").append(URLEncoder.encode(params.get(k).toString(), CHAR
SET)).append("&");©2013-2022 Tencent Cloud. All rights reserved.

Page 53 of 190

TencentDB for MongoDB}
return url.toString().substring(0, url.length() - 1);}
public static void main(String[] args) throws Exception {TreeMap<String, Object> params = new TreeMap<String, Object>(); // TreeMap enable
s automatic sorting// A random number should be used when actually calling, for example: params.put("Nonce", new Random().nextInt(java.lang.Integer.MAX_VALUE));params.put("Nonce", 11886); // Common parameter// The current time of the system should be used when actually calling, for examp
le: params.put("Timestamp", System.currentTimeMillis() / 1000);params.put("Timestamp", 1465185768); // Common parameterparams.put("SecretId", "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******"); // Common parameterparams.put("Action", "DescribeInstances"); // Common parameterparams.put("Version", "2017-03-12"); // Common parameterparams.put("Region", "ap-guangzhou"); // Common parameterparams.put("Limit", 20); // Business parameterparams.put("Offset", 0); // Business parameterparams.put("InstanceIds.0", "ins-09dx96dg"); // Business parameterparams.put("Signature", sign(getStringToSign(params), "Gu5t9xGARNpq86cd98joQYCN3*******", "HmacSHA1")); // Common parameter
System.out.println(getUrl(params));}}

PythonNote: If running in a Python 2 environment, the following requests dependency package must be installed first: pip
install requests .

# -*- coding: utf8 -*import base64
import hashlib
import hmac
import time
import requests
secret_id = "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******"
secret_key = "Gu5t9xGARNpq86cd98joQYCN3*******"
def get_string_to_sign(method, endpoint, params):
s = method + endpoint + "/?"
query_str = "&".join("%s=%s" % (k, params[k]) for k in sorted(params))
return s + query_str
def sign_str(key, s, method):
hmac_str = hmac.new(key.encode("utf8"), s.encode("utf8"), method).digest()
return base64.b64encode(hmac_str)©2013-2022 Tencent Cloud. All rights reserved.

Page 54 of 190

TencentDB for MongoDB

if __name__ == '__main__':endpoint = "cvm.tencentcloudapi.com"
data = {'Action' : 'DescribeInstances','InstanceIds.0' : 'ins-09dx96dg','Limit' : 20,'Nonce' : 11886,'Offset' : 0,
'Region' : 'ap-guangzhou','SecretId' : secret_id,'Timestamp' : 1465185768, # int(time.time())'Version': '2017-03-12'}
s = get_string_to_sign("GET", endpoint, data)
data["Signature"] = sign_str(secret_key, s, hashlib.sha1)
print(data["Signature"])# An actual invocation would occur here, which may incur fees after success# resp = requests.get("https://" + endpoint, params=data)# print(resp.url)

Golangpackage main
import ("bytes""crypto/hmac""crypto/sha1""encoding/base64""fmt""sort")
func main() {secretId := "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******"
secretKey := "Gu5t9xGARNpq86cd98joQYCN3*******"
params := map[string]string{"Nonce": "11886","Timestamp": "1465185768","Region": "ap-guangzhou","SecretId": secretId,"Version": "2017-03-12","Action": "DescribeInstances","InstanceIds.0": "ins-09dx96dg","Limit": "20","Offset": "0",}var buf bytes.Buffer©2013-2022 Tencent Cloud. All rights reserved.

Page 55 of 190

TencentDB for MongoDB

buf.WriteString("GET")
buf.WriteString("cvm.tencentcloudapi.com")buf.WriteString("/")
buf.WriteString("?")// sort keys by ascii asc orderkeys := make([]string, 0, len(params))
for k, _ := range params {keys = append(keys, k)}sort.Strings(keys)
for i := range keys {k := keys[i]buf.WriteString(k)buf.WriteString("=")
buf.WriteString(params[k])buf.WriteString("&")}
buf.Truncate(buf.Len() - 1)hashed := hmac.New(sha1.New, []byte(secretKey))hashed.Write(buf.Bytes())
fmt.Println(base64.StdEncoding.EncodeToString(hashed.Sum(nil)))
}

PHP
<?php
$secretId = "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******";$secretKey = "Gu5t9xGARNpq86cd98joQYCN3*******";$param["Nonce"] = 11886;//rand();$param["Timestamp"] = 1465185768;//time();$param["Region"] = "ap-guangzhou";$param["SecretId"] = $secretId;$param["Version"] = "2017-03-12";$param["Action"] = "DescribeInstances";$param["InstanceIds.0"] = "ins-09dx96dg";$param["Limit"] = 20;$param["Offset"] = 0;
ksort($param);$signStr = "GETcvm.tencentcloudapi.com/?";foreach ( $param as $key => $value ) {$signStr = $signStr . $key . "=" . $value . "&";}
$signStr = substr($signStr, 0, -1);
$signature = base64_encode(hash_hmac("sha1", $signStr, $secretKey, true));echo $signature.PHP_EOL;// need to install and enable curl extension in php.ini©2013-2022 Tencent Cloud. All rights reserved.

Page 56 of 190

TencentDB for MongoDB// $param["Signature"] = $signature;// $url = "https://cvm.tencentcloudapi.com/?".http_build_query($param);// echo $url.PHP_EOL;// $ch = curl_init();// curl_setopt($ch, CURLOPT_URL, $url);// $output = curl_exec($ch);// curl_close($ch);// echo json_decode($output);Ruby# -*- coding: UTF-8 -*# require ruby>=2.3.0
require 'time'require 'openssl'
require 'base64'
secret_id = "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******"
secret_key = "Gu5t9xGARNpq86cd98joQYCN3*******"
method = 'GET'
endpoint = 'cvm.tencentcloudapi.com'
data = {'Action' => 'DescribeInstances','InstanceIds.0' => 'ins-09dx96dg','Limit' => 20,'Nonce' => 11886,'Offset' => 0,'Region' => 'ap-guangzhou','SecretId' => secret_id,'Timestamp' => 1465185768, # Time.now.to_i'Version' => '2017-03-12',}
sign = method + endpoint + '/?'
params = []data.sort.each do |item|
params << "#{item[0]}=#{item[1]}"endsign += params.join('&')
digest = OpenSSL::Digest.new('sha1')
data['Signature'] = Base64.encode64(OpenSSL::HMAC.digest(digest, secret_key, sign))puts data['Signature']# require 'net/http'# uri = URI('https://' + endpoint)# uri.query = URI.encode_www_form(data)# p uri©2013-2022 Tencent Cloud. All rights reserved.

Page 57 of 190

TencentDB for MongoDB# res = Net::HTTP.get_response(uri)# puts res.body

DotNetusing System;
using System.Collections.Generic;using System.Net;
using System.Security.Cryptography;
using System.Text;
public class Application {public static string Sign(string signKey, string secret){string signRet = string.Empty;
using (HMACSHA1 mac = new HMACSHA1(Encoding.UTF8.GetBytes(signKey))){byte[] hash = mac.ComputeHash(Encoding.UTF8.GetBytes(secret));signRet = Convert.ToBase64String(hash);}return signRet;}
public static string MakeSignPlainText(SortedDictionary<string, string> requestParams, string requestMethod, string requestHost, string requestPath){string retStr = "";retStr += requestMethod;
retStr += requestHost;
retStr += requestPath;
retStr += "?";
string v = "";foreach (string key in requestParams.Keys){v += string.Format("{0}={1}&", key, requestParams[key]);}
retStr += v.TrimEnd('&');
return retStr;}
public static void Main(string[] args){
string SECRET_ID = "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******";
string SECRET_KEY = "Gu5t9xGARNpq86cd98joQYCN3*******";
string endpoint = "cvm.tencentcloudapi.com";string region = "ap-guangzhou";string action = "DescribeInstances";
string version = "2017-03-12";
double RequestTimestamp = 1465185768;©2013-2022 Tencent Cloud. All rights reserved.

Page 58 of 190

TencentDB for MongoDB// long timestamp = ToTimestamp() / 1000;// string requestTimestamp = timestamp.ToString();
Dictionary<string, string> param = new Dictionary<string, string>();param.Add("Limit", "20");param.Add("Offset", "0");param.Add("InstanceIds.0", "ins-09dx96dg");
param.Add("Action", action);param.Add("Nonce", "11886");// param.Add("Nonce", Math.Abs(new Random().Next()).ToString());
param.Add("Timestamp", RequestTimestamp.ToString());
param.Add("Version", version);param.Add("SecretId", SECRET_ID);
param.Add("Region", region);
SortedDictionary<string, string> headers = new SortedDictionary<string, string>(param, StringComparer.Ordinal);
string sigInParam = MakeSignPlainText(headers, "GET", endpoint, "/");
Console.WriteLine(sigInParam);
string sigOutParam = Sign(SECRET_KEY, sigInParam);
Console.WriteLine("GET https://cvm.tencentcloudapi.com");foreach (KeyValuePair<string, string> kv in headers){Console.WriteLine(kv.Key + ": " + kv.Value);}
Console.WriteLine("Signature" + ": " + WebUtility.UrlEncode(sigOutParam));
Console.WriteLine();string result = "https://cvm.tencentcloudapi.com/?";foreach (KeyValuePair<string, string> kv in headers){
result += WebUtility.UrlEncode(kv.Key) + "=" + WebUtility.UrlEncode(kv.Value) +"&";}result += WebUtility.UrlEncode("Signature") + "=" + WebUtility.UrlEncode(sigOutPa
ram);
Console.WriteLine("GET " + result);}}

NodeJS
const crypto = require('crypto');function get_req_url(params, endpoint){
params['Signature'] = escape(params['Signature']);const url_strParam = sort_params(params)
return "https://" + endpoint + "/?" + url_strParam.slice(1);}function formatSignString(reqMethod, endpoint, path, strParam){©2013-2022 Tencent Cloud. All rights reserved.

Page 59 of 190

TencentDB for MongoDB

let strSign = reqMethod + endpoint + path + "?" + strParam.slice(1);return strSign;}function sha1(secretKey, strsign){
let signMethodMap = {'HmacSHA1': "sha1"};
let hmac = crypto.createHmac(signMethodMap['HmacSHA1'], secretKey || "");
return hmac.update(Buffer.from(strsign, 'utf8')).digest('base64')}function sort_params(params){
let strParam = "";let keys = Object.keys(params);
keys.sort();for (let k in keys) {//k = k.replace(/_/g, '.');
strParam += ("&" + keys[k] + "=" + params[keys[k]]);}return strParam}function main(){const SECRET_ID = "AKIDz8krbsJ5yKBZQpn74WFkmLPx3*******"
const SECRET_KEY = "Gu5t9xGARNpq86cd98joQYCN3*******"
const endpoint = "cvm.tencentcloudapi.com"
const Region = "ap-guangzhou"
const Version = "2017-03-12"
const Action = "DescribeInstances"
const Timestamp = 1465185768// const Timestamp = Math.round(Date.now() / 1000)
const Nonce = 11886//const nonce = Math.round(Math.random() * 65535)
let params = {};params['Action'] = Action;
params['InstanceIds.0'] = 'ins-09dx96dg';
params['Limit'] = 20;
params['Offset'] = 0;params['Nonce'] = Nonce;params['Region'] = Region;
params['SecretId'] = SECRET_ID;
params['Timestamp'] = Timestamp;
params['Version'] = Version;
strParam = sort_params(params)
const reqMethod = "GET";
const path = "/";
strSign = formatSignString(reqMethod, endpoint, path, strParam)
console.log(strSign)
console.log("-----------------------")
params['Signature'] = sha1(SECRET_KEY, strSign)
console.log(params['Signature'])©2013-2022 Tencent Cloud. All rights reserved.

Page 60 of 190

TencentDB for MongoDB

console.log("-----------------------")
const req_url = get_req_url(params, endpoint)
console.log(params['Signature'])console.log("-----------------------")
console.log(req_url)}
main()©2013-2022 Tencent Cloud. All rights reserved.

Page 61 of 190

TencentDB for MongoDB

Responses：

Last updated 2020-03-04 23:46:32

Response for Successful Requests
For example, when calling CAM API (version: 2017-03-12) to view the status of instances (DescribeInstancesStatus),
if the request has succeeded, you may see the response as shown below:{"Response": {"TotalCount": 0,"InstanceStatusSet": [],"RequestId": "b5b41468-520d-4192-b42f-595cc34b6c1c"}}
The API will return Response , which contains RequestId , as long as it processes the request. It does notmatter if the request is successful or not.
RequestId is the unique ID of an API request. Contact us with this ID when an exception occurs.
Except for the fixed fields, all fields are action-specified. For the definitions of action-specified fields, see thecorresponding API documentation. In this example, TotalCount and InstanceStatusSet are the fields
specified by the API DescribeInstancesStatus . 0 TotalCount means that the requester owns 0 CVM
instance so the InstanceStatusSet is empty.

Response for Failed Requests
If the request has failed, you may see the response as shown below:{"Response": {"Error": {"Code": "AuthFailure.SignatureFailure","Message": "The provided credentials could not be validated. Please ensure your signature is correct."},"RequestId": "ed93f3cb-f35e-473f-b9f3-0d451b8b79c6"}}©2013-2022 Tencent Cloud. All rights reserved.

Page 62 of 190

TencentDB for MongoDB

The presence of the Error field indicates that the request has failed. A response for a failed request will include
Error , Code and Message fields.
Code is the code of the error that helps you identify the cause and solution. There are two types of error codes
so you may find the code in either common error codes or API-specified error codes.
Message explains the cause of the error. Note that the returned messages are subject to service updates. The
information the messages provide may not be up-to-date and should not be the only source of reference.
RequestId is the unique ID of an API request. Contact us with this ID when an exception occurs.

Common Error Codes
If there is an Error field in the response, it means that the API call failed. The Code field in Error indicates the error
code. The following table lists the common error codes that all actions can return.
Error CodeDescription

AuthFailure.InvalidSecretId

Invalid key (not a TencentCloud API key type).

AuthFailure.MFAFailure

MFA failed.

AuthFailure.SecretIdNotFoundThe key does not exist.

AuthFailure.SignatureExpire

Signature expired.

AuthFailure.SignatureFailure

Signature error.

AuthFailure.TokenFailure

Token error.

AuthFailure.UnauthorizedOperation

The request does not have CAM authorization.

DryRunOperation

DryRun Operation. It means that the request would have succeeded, but
the DryRun parameter was used.

FailedOperation

Operation failed.

InternalError

Internal error.

InvalidAction

The API does not exist.

InvalidParameter

Incorrect parameter.

InvalidParameterValue

Invalid parameter value.

LimitExceeded

Quota limit exceeded.

©2013-2022 Tencent Cloud. All rights reserved.

Page 63 of 190

TencentDB for MongoDB

Error CodeDescription

MissingParameter

A parameter is missing.

NoSuchVersion

The API version does not exist.

RequestLimitExceeded

The number of requests exceeds the frequency limit.

ResourceInUse

Resource is in use.

ResourceInsufficientInsufficient resource.

ResourceNotFoundThe resource does not exist.

ResourceUnavailable

Resource is unavailable.

UnauthorizedOperation

Unauthorized operation.

UnknownParameter

Unknown parameter.

UnsupportedOperation

Unsupported operation.

UnsupportedProtocol

HTTPS request method error. Only GET and POST requests aresupported.

UnsupportedRegion

API does not support the requested region.

©2013-2022 Tencent Cloud. All rights reserved.

Page 64 of 190

TencentDB for MongoDB

Instance APIs
RenameInstance：

Last updated 2023-03-20 10:55:13

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to rename a TencentDB instance.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter
Name

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API: RenameInstance.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

String

Instance ID in the format of cmgo-p8vnipr5. It is the same as the instance
ID displayed on the TencentDB Console page

NewNameYes

StringCustom name of the instance, which can contain up to 60 letters, digits, or
symbols (_-)

3. Output Parameters©2013-2022 Tencent Cloud. All rights reserved.

Page 65 of 190

TencentDB for MongoDB

Parameter
Name

Type

Description

RequestId

String

The unique request ID, which is returned for each request. RequestId is required forlocating a problem.

4. Example
Example1 Renaming a TencentDB instance
Input Example
https://mongodb.tencentcloudapi.com/?Action=RenameInstance&InstanceId=cmgo-eqmoa5sf&NewName=test_name&<Common request parameters>

Output Example{"Response": {"RequestId": "8e2a339e-5ba9-4da3-8dc2-65a0a6314811"}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++©2013-2022 Tencent Cloud. All rights reserved.

Page 66 of 190

TencentDB for MongoDB

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform thisoperation.

InvalidParameterValue.IllegalInstanceName

Invalid instance name

InvalidParameterValue.InstanceHasBeenDeleted

The instance has been deleted.

InvalidParameterValue.InstanceHasBeenIsolated

The instance has been isolated.

InvalidParameterValue.NotFoundInstance

The instance was not found.

©2013-2022 Tencent Cloud. All rights reserved.

Page 67 of 190

TencentDB for MongoDB

OfflineIsolatedDBInstance：

Last updated 2023-03-20 10:55:13

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to deactivate isolated TencentDB instances immediately. The instances must be in isolated status.
A maximum of 10 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter
Name

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API: OfflineIsolatedDBInstance.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

String

Instance ID in the format of cmgo-p8vnipr5. It is the same as the instance
ID displayed on the TencentDB Console page

3. Output Parameters
Parameter
Name

Type

Description

AsyncRequestId

StringAsync task request ID, which can be used to query the execution result of an©2013-2022 Tencent Cloud. All rights reserved.

Page 68 of 190

TencentDB for MongoDB

async task.
RequestId

String

The unique request ID, which is returned for each request. RequestId is required
for locating a problem.

4. Example
Example1 Eliminating an isolated TencentDB instance
Input Example
https://mongodb.tencentcloudapi.com/?Action=OfflineIsolatedDBInstance&InstanceId=cmgo-f555zzzz&<Common request parameters>

Output Example{"Response": {"RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7","AsyncRequestId": "28920"}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface©2013-2022 Tencent Cloud. All rights reserved.

Page 69 of 190

TencentDB for MongoDB

Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeInvalidParameter.PermissionDenied

Description
The current subaccount has no permission to perform thisoperation.

InvalidParameterValue.IllegalStatusToOffline

The instance cannot be deactivated in the current status.
Only isolated instances can be deactivated.

InvalidParameterValue.InstanceHasBeenDeleted

The instance has been deleted.

InvalidParameterValue.LockFailed

Instance lock failed.

InvalidParameterValue.NotFoundInstance

The instance was not found.

©2013-2022 Tencent Cloud. All rights reserved.

Page 70 of 190

TencentDB for MongoDB

ModifyDBInstanceSpec：

Last updated 2023-03-20 10:55:13

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to adjust the specification configuration of a TencentDB for MongoDB. The purchasable
specifications supported by the API can be obtained through the DescribeSpecInfo API.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter Name

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API:
ModifyDBInstanceSpec.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

String

Instance ID in the format of cmgo-p8vnipr5. It is the same as theinstance ID displayed on the TencentDB Console page

MemoryYes

Integer

Memory size after instance configuration change in GB. Memoryand disk must be upgraded or degraded simultaneously

Integer

Disk size after instance configuration change in GB. Memory anddisk must be upgraded or degraded simultaneously. For
degradation, the new disk capacity must be greater than 1.2
times the used disk capacity

VolumeYes©2013-2022 Tencent Cloud. All rights reserved.

Page 71 of 190

TencentDB for MongoDB

OplogSize

NodeNum

No

IntegerNo

Integer

Oplog size after instance configuration change in GB, whichranges from 10% to 90% of the disk capacity and is 10% of thedisk capacity by default
Node quantity after configuration modification. The value range issubject to the response parameter of the
DescribeSpecInfo API. If this parameter is left empty, thenode quantity remains unchanged.

ReplicateSetNum

No

Integer

Shard quantity after configuration modification, which can only be
increased rather than decreased. The value range is subject tothe response parameter of the DescribeSpecInfo API. If
this parameter is left empty, the shard quantity remains
unchanged.
Switch time. Valid values: 0 (upon modification completion),

InMaintenanceNo

Integer

1 (during maintenance time). Default value: 0 . If the quantity
of nodes or shards is modified, the value will be 0 .

3. Output Parameters
Parameter
Name

Type

Description

DealIdStringOrder ID

RequestId

String

The unique request ID, which is returned for each request. RequestId is required forlocating a problem.

4. Example
Example1 Adjusting the configurations of a TencentDB instance
Input Example
https://mongodb.tencentcloudapi.com/?Action=ModifyDBInstanceSpec&InstanceId=cmgo-p8vnipr5&Memory=4&Volume=250&<Common request parameters>©2013-2022 Tencent Cloud. All rights reserved.

Page 72 of 190

TencentDB for MongoDB

Output Example{"Response": {"RequestId": "d88095e5-50e8-4245-a0cf-993a536f9b20","DealId": "7142863"}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InvalidParameter.ZoneClosed

Instances are not purchasable in this AZ.

InvalidParameterValue.InvalidTradeOperation

Billing error. Corresponding purchase/renewal/configuration
change operations are not allowed for the current instance.

InvalidParameterValue.ModifyModeError

Memory and disk must be upgraded or degraded©2013-2022 Tencent Cloud. All rights reserved.

Page 73 of 190

TencentDB for MongoDB

simultaneously.
InvalidParameterValue.NotFoundInstance
InvalidParameterValue.OplogSizeOutOfRange

The instance was not found.
The OplogSize parameter is set incorrectly and should
be between 10% and 90% of the disk capacity.

InvalidParameterValue.SetDiskLessThanUsed

The disk size to be set cannot be less than 1.2 times the useddisk capacity.

InvalidParameterValue.SpecNotOnSale

Incorrect purchasable specification.

InvalidParameterValue.StatusAbnormal

The instance is in a status where operations are not allowed.

©2013-2022 Tencent Cloud. All rights reserved.

Page 74 of 190

TencentDB for MongoDB

IsolateDBInstance：

Last updated 2023-03-20 10:55:14

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to isolate a pay-as-you-go TencentDB for MongoDB instance. An isolated instance is retained in therecycle bin and data can no longer be written to it. After it is isolated for a certain period of time, it will be completely
deleted. For the retention period in the recycle bin, please see the terms of service for pay-as-you-go billing. Isolated
pay-as-you-go instances cannot be recovered, so please proceed with caution.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter
Name

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API: IsolateDBInstance.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

String

Instance ID in the format of cmgo-p8vnipr5. It is the same as the instance
ID displayed on the TencentDB Console page

3. Output Parameters©2013-2022 Tencent Cloud. All rights reserved.

Page 75 of 190

TencentDB for MongoDB

Parameter
Name

Type

Description

AsyncRequestId

StringAsync task request ID, which can be used to query the execution result of anasync task.

RequestId

String

The unique request ID, which is returned for each request. RequestId is required
for locating a problem.

4. Example
Example1 Terminating a pay-as-you-go TencentDB instance
Input Example
https://mongodb.tencentcloudapi.com/?Action=IsolateDBInstance&InstanceId=cmgo-f555zzzz&<Common request parameters>

Output Example{"Response": {"RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7","AsyncRequestId": "28920"}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS©2013-2022 Tencent Cloud. All rights reserved.

Page 76 of 190

TencentDB for MongoDB

Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InvalidParameter

Parameter error

InvalidParameter.PermissionDenied

The current subaccount has no permission to
perform this operation.

InvalidParameterValue.InstanceHasBeenDeleted

The instance has been deleted.

InvalidParameterValue.InstanceHasBeenIsolated

The instance has been isolated.

InvalidParameterValue.LockFailed

Instance lock failed.

InvalidParameterValue.NotFoundInstance

The instance was not found.

InvalidParameterValue.PrePaidInstanceUnableToIsolate

Prepaid instances cannot be terminated.

©2013-2022 Tencent Cloud. All rights reserved.

Page 77 of 190

TencentDB for MongoDB

DescribeSpecInfo：

Last updated 2023-03-20 10:55:15

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to query the purchasable instance specifications.
A maximum of 10 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter Name

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API: DescribeSpecInfo.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

Zone

No

String

AZ to be queried

3. Output Parameters
Parameter
Name

Type

Description

SpecInfoList

Array ofSpecificationInfo

List of purchasable instance specifications©2013-2022 Tencent Cloud. All rights reserved.

Page 78 of 190

TencentDB for MongoDB

RequestId

String

The unique request ID, which is returned for each request. RequestId isrequired for locating a problem.

4. Example
Example1 Querying a purchasable instance
Input Example
POST / HTTP/1.1
Host: mongodb.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeSpecInfo<Common request parameters>{"Zone": "xx"}

Output Example{"Response": {"RequestId": "a8c7ade4-2d22-4f5e-9e71-f546f15e6d67","SpecInfoList": [{"Region": "ap-guangzhou","SpecItems": [{"ClusterType": 0,"Conns": 1500,"Cpu": 2,"DefaultStorage": 25600,"EngineName": "WiredTiger","MachineType": "HIO10G","MaxNodeNum": 3,"MaxReplicateSetNodeNum": 5,"MaxReplicateSetNum": 20,"MaxStorage": 512000,"Memory": 4096,"MinNodeNum": 3,"MinReplicateSetNodeNum": 3,"MinReplicateSetNum": 2,"MinStorage": 102400,©2013-2022 Tencent Cloud. All rights reserved.

Page 79 of 190

TencentDB for MongoDB"MongoVersionCode": "MONGO_36_WT","MongoVersionValue": 4,"Qps": 5000,"SpecCode": "mongo.HIO10G.4g","Status": 1,"Version": "3.6"},{"ClusterType": 0,"Conns": 1500,"Cpu": 2,"DefaultStorage": 25600,"EngineName": "WiredTiger","MachineType": "HIO10G","MaxNodeNum": 3,"MaxReplicateSetNodeNum": 5,"MaxReplicateSetNum": 20,"MaxStorage": 512000,"Memory": 4096,"MinNodeNum": 3,"MinReplicateSetNodeNum": 3,"MinReplicateSetNum": 2,"MinStorage": 102400,"MongoVersionCode": "MONGO_3_WT","MongoVersionValue": 2,"Qps": 5000,"SpecCode": "mongo.HIO10G.4g","Status": 1,"Version": "3.2"},{"ClusterType": 1,"Conns": 15000,"Cpu": 48,"DefaultStorage": 4096000,"EngineName": "WiredTiger","MachineType": "HIO10G","MaxNodeNum": 3,"MaxReplicateSetNodeNum": 5,"MaxReplicateSetNum": 20,"MaxStorage": 6144000,"Memory": 524288,"MinNodeNum": 3,"MinReplicateSetNodeNum": 3,"MinReplicateSetNum": 2,"MinStorage": 1536000,"MongoVersionCode": "MONGO_36_WT",©2013-2022 Tencent Cloud. All rights reserved.

Page 80 of 190

TencentDB for MongoDB"MongoVersionValue": 4,"Qps": 42000,"SpecCode": "mongo.HIO10G.512g","Status": 1,"Version": "3.6"}],"Zone": "ap-guangzhou-3"}]}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform this operation.

©2013-2022 Tencent Cloud. All rights reserved.

Page 81 of 190

TencentDB for MongoDB

InvalidParameterValue.RegionError

Invalid region

InvalidParameterValue.ZoneError

Invalid availability zone

©2013-2022 Tencent Cloud. All rights reserved.

Page 82 of 190

TencentDB for MongoDB

DescribeDBInstances：

Last updated 2023-04-06 10:21:25

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to query the list of TencentDB instances (which can be primary, disaster recovery, or read-only
instances). It supports filtering instances by project ID, instance ID, and instance status.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter
Name

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API:
DescribeDBInstances.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceIds.N

No

Array
of
StringList of instance IDs in the format of cmgo-p8vnipr5. It is the same as
the instance ID displayed on the TencentDB console page.

InstanceType

No

Integer

Instance type. Valid values:
0 : All instances.
1 : Regular instances.
2 : Temp instances.
3 : Read-only instances.

©2013-2022 Tencent Cloud. All rights reserved.

Page 83 of 190

TencentDB for MongoDB-1 : Regular instances, read-only instances, disaster recovery
instances.

Cluster type. Valid values:
0 : Replica set instances.
ClusterType

No

Integer

1 : Sharded cluster instances.
-1 : All instances.

Instance status. Valid values:
0 : To be initialized.
Status.N

No

Array
of
Integer

1 : In process.
2 : Valid.
-2 : Isolated (for monthly subscribed instances).
-3 : Isolated (for pay-as-you-go instances).

VpcId

No

String

VPC ID. This parameter can be left empty for the classic network.

SubnetId

No

StringSubnet ID of VPC. This parameter can be left empty for the classic
network. If it is passed in as an input parameter, the corresponding
VpcId must be set.

PayModeNo

Integer

Billing type. Valid value: 0 (pay-as-you-go)

Limit

No

Integer

OffsetNo

IntegerNumber of results returned per request. Default value: 20 . Value
range: [1,100].
Offset. Default value: 0 .
Sort by field of the returned result set. Valid values: ProjectId ,OrderByNo

String

InstanceName , CreateTime . The return results are sorted
in ascending order by default.

OrderByType

Sorting method of the return result set. Valid values: ASC ,No

StringProjectIds.N

No

Array
of
Integer

Project ID

SearchKey

No

StringSearch keyword, which can be instance ID, instance name, orcomplete IP.

Tags.NNo

Array

Tag information©2013-2022 Tencent Cloud. All rights reserved.

DESC .

Page 84 of 190

TencentDB for MongoDB

ofTagInfo

3. Output Parameters
Parameter
Name

Type

Description

TotalCount

IntegerNumber of eligible instances

InstanceDetails

Array of
InstanceDetail

List of instance details

RequestId

String

The unique request ID, which is returned for each request. RequestId isrequired for locating a problem.

4. Example
Example1 Querying the list of instancesThis example shows you how to query the list of instances.
Input Example
POST / HTTP/1.1
Host: mongodb.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeDBInstances<Common request parameters>{"Status": [0],"OrderBy": "xx","InstanceIds": ["xx"],"VpcId": "xx","Tags": [{"TagKey": "xx","TagValue": "xx"©2013-2022 Tencent Cloud. All rights reserved.

Page 85 of 190

TencentDB for MongoDB}],"ClusterType": 0,"PayMode": 0,"Limit": 1,"SearchKey": "xx","Offset": 1,"SubnetId": "xx","OrderByType": "xx","InstanceType": 0,"ProjectIds": [1]}

Output Example{"Response": {"TotalCount": 1,"RequestId": "xx","InstanceDetails": [{"ConfigServerMemory": 1,"Zone": "xx","MongosNodeNum": 1,"ReadonlyInstances": [{"InstanceId": "xx","Region": "xx"}],"RelatedInstance": "xx","AutoRenewFlag": 0,"DeadLine": "2020-09-22 00:00:00","Memory": 1,"StandbyInstances": [{"InstanceId": "xx","Region": "xx"}],"InstanceVer": 1,"MaintenanceStart": "xx","RealInstanceId": "xx","CpuNum": 1,©2013-2022 Tencent Cloud. All rights reserved.

Page 86 of 190

TencentDB for MongoDB"MaintenanceEnd": "xx","VpcId": "xx","CloneInstances": [{"InstanceId": "xx","Region": "xx"}],"InstanceId": "xx","ConfigServerCpuNum": 1,"Volume": 1,"SecondaryNum": 1,"NetType": 1,"MongoVersion": "xx","ReplicationSetNum": 1,"ReplicaSets": [{"UsedVolume": 0.0,
"ReplicaSetId": "xx","Volume": 1,"SecondaryNum": 1,"OplogSize": 1,"Memory": 1,"ReplicaSetName": "xx","RealReplicaSetId": "xx"}],"InstanceType": 1,"Status": 1,"ProjectId": 1,"ClusterType": 1,"PayMode": 1,"SubnetId": "xx","ClusterVer": 1,"MongosCpuNum": 1,"ReadonlyNodeNum": 1,"Protocol": 1,"InstanceName": "xx","MongosMemory": 1,"MachineType": "xx","InstanceStatusDesc": "xx","Tags": [{"TagKey": "xx","TagValue": "xx"}],©2013-2022 Tencent Cloud. All rights reserved.

Page 87 of 190

TencentDB for MongoDB"UsedVolume": 1,"Vip": "xx","ConfigServerVolume": 1,"Region": "xx","ConfigServerNodeNum": 1,"Vport": 1,"CreateTime": "2020-09-22 00:00:00"}]}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform thisoperation.

©2013-2022 Tencent Cloud. All rights reserved.

Page 88 of 190

TencentDB for MongoDB

InvalidParameterValue.IllegalInstanceStatus

Invalid instance status

InvalidParameterValue.RegionError

Invalid region

InvalidParameterValue.VpcIdOrSubnetIdNotFoundThe VPC (subnet) was not found.

InvalidParameterValue.ZoneError

Invalid availability zone

UnsupportedOperation

Unsupported operation©2013-2022 Tencent Cloud. All rights reserved.

Page 89 of 190

TencentDB for MongoDB

DescribeClientConnections：

Last updated 2023-03-20 10:55:17

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to query the client connection information of an instance, including the IP and number of connections.
Currently, only instances of MongoDB 3.2 are supported.
A maximum of 5 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter
Name

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API:
DescribeClientConnections.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

String

Instance ID in the format of cmgo-p8vnipr5. It is the same as the instance
ID displayed on the TencentDB Console page

Limit

No

IntegerNumber of results to be returned for a single request. Value range: 11,000. Default value: 1,000

OffsetNo

Integer

Offset. Default value: 0.

©2013-2022 Tencent Cloud. All rights reserved.

Page 90 of 190

TencentDB for MongoDB

3. Output Parameters
Parameter
Name

Type

Description

Clients

Array ofClientConnection

Client connection information, including client IP and number ofconnections

TotalCount

Integer

The total number of records that meet the query condition, which can beused for paginated queries.

RequestId

String

The unique request ID, which is returned for each request. RequestId isrequired for locating a problem.

4. Example
Example1 Querying the client connections of a TencentDB instance
Input Example
https://mongodb.tencentcloudapi.com/?Action=DescribeClientConnections&InstanceId=cmgo-eqmoaxxx&<Common request parameters>

Output Example{"Response": {"TotalCount": 1,"Clients": [{"Count": 1,"IP": "xx","InternalService": true},{"Count": 1,"IP": "xx","InternalService": true}],
"RequestId": "xx"©2013-2022 Tencent Cloud. All rights reserved.

Page 91 of 190

TencentDB for MongoDB}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InvalidParameter.PermissionDenied

The current subaccount has no permission to
perform this operation.

InvalidParameterValue.MongoVersionNotSupportQueryClient

The instance version does not support
querying the instance client information.

InvalidParameterValue.NotFoundInstance

The instance was not found.

InvalidParameterValue.ProxyNotSupportQueryClient

The proxy version does not support querying
the instance client information. Please submit aticket for upgrade.

InvalidParameterValue.RegionNotSupportQueryClient©2013-2022 Tencent Cloud. All rights reserved.

The region does not support querying thePage 92 of 190

TencentDB for MongoDB

instance client information.

©2013-2022 Tencent Cloud. All rights reserved.

Page 93 of 190

TencentDB for MongoDB

CreateDBInstanceHour：

Last updated 2023-03-20 10:55:17

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to create a pay-as-you-go TencentDB for MongoDB instance.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter Name

RequiredType

Description

ActionYes

StringCommon Params. The value used for this
API: CreateDBInstanceHour.

VersionYes

StringRegionNo

StringMemoryYes

Integer

Instance memory size in GB

VolumeYes

Integer

Instance disk size in GB

ReplicateSetNum

Yes

IntegerNumber of replica sets

Common Params. The value used for this
API: 2019-07-25.
Common Params. This parameter is not
required for this API.

- Number of the replica set instances to becreated. Valid value: 1 .
- Number of sharded cluster instances to becreated. You can get the specific purchasable©2013-2022 Tencent Cloud. All rights reserved.

Page 94 of 190

TencentDB for MongoDB

specifications through the DescribeSpecInfo
API.

NodeNum

Yes

Integer

The number of nodes in each replica set. You
can get the specific purchasable
specifications through the DescribeSpecInfo
API.
Version information. You can get the specificpurchasable specifications through the
DescribeSpecInfo API.

：
- MONGO_40_WT：MongoDB 4.0
WiredTiger storage engine- MONGO_42_WT：MongoDB 4.2
WiredTiger storage engine- MONGO_44_WT：MongoDB 4.4- MONGO_36_WT MongoDB 3.6
WiredTiger storage engine

MongoVersion

Yes

StringWiredTiger storage engine
Machine type
MachineCode

Yes

String- HIO: High IO- HIO10G: 10-Gigabit high IO

GoodsNum

Yes

IntegerNumber of instances. Value range: 1-10.
AZ information in the format of apguangzhou-2

Zone

Yes

String- For more information, query through the
DescribeSpecInfo API.
- If multi-AZ deployment is enabled, thisparameter refers to the primary AZ and must
be one of the values of
AvailabilityZoneList .
Instance architecture type

ClusterType

Yes

String- REPLSET: Replica set- SHARD: Sharded cluster

VpcId

No

String

VPC ID

SubnetId

No

StringPassword

No

String

VPC subnet ID. If VpcId is set, thenSubnetId will be required.
Instance password- If it is left empty, the password is in thedefault format of "instance ID+@+root©2013-2022 Tencent Cloud. All rights reserved.

Page 95 of 190

TencentDB for MongoDB

account UIN". For example, if the instance ID
is "cmgo-higv73ed" and the root account UIN"100000001", the instance password will be"cmgo-higv73ed@100000001".
- The custom password must contain 8-32
characters in at least two of the following
types: letters, digits, and symbols (!@#%^*()_).
ProjectId

No

Integer

Project ID. If it is left empty, Default
project will be used.

Array
Tags.NNo

of
TagInfo

Instance tag information

Instance type. Valid values:
Clone

No

Integer- 1 : Primary instance- 3 : Read-only instance- 4 : Disaster recovery instanceFatherNo

StringParent instance ID. It is required if theClone is 3 or 4 , that is, read-only
instance or disaster recovery instance

Array
SecurityGroup.N

No

of

Security group

StringRollback time of the cloned instance

RestoreTime

No

String- This parameter is required for a cloned
instance in the format of 2021-08-13
16:30:00.
- Time range for rollback: You can roll backdata in the last 7 days.

InstanceName

No

String

Instance name, which can contain up to 60
letters, digits, and symbols (_-).

AvailabilityZoneList.N

No

Array

List of multi-AZ deployed nodes. For moreofStringinformation, query through the
DescribeSpecInfo API.
- Nodes of a multi-AZ instance must be
deployed across three AZs. Most nodes of thecluster can’t be deployed in the same AZ. For
example, a three-node sharded cluster
instance does not support deploying two or©2013-2022 Tencent Cloud. All rights reserved.

Page 96 of 190

TencentDB for MongoDB

more nodes in the same AZ.
- MongoDB 4.2 and later versions do notsupport multi-AZ deployment.
- Read-only and disaster recovery instances
do not support multi-AZ deployment.
-Instances in the classic network do notsupport multi-AZ deployment.
Number of Mongos CPU cores- This parameter is not required for a sharded
cluster instance of MongoDB 3.6 WiredTiger
MongosCpu

No

Integeror later.
- If this parameter is not configured, themongos specification will be configured basedon the mongod specification, and the default
specification is free of charge.
Mongos memory size
- This parameter is not required for a sharded

MongosMemory

No

Integercluster instance of MongoDB 3.6 WiredTiger
or later.
- If this parameter is not configured, themongos specification will be configured basedon the mongod specification, and the default
specification is free of charge.
Number of Monogs- This parameter is not required for a sharded
cluster instance of MongoDB 3.6 WiredTiger

MongosNodeNum

No

Integeror later.
- If this parameter is not configured, themongos specification will be configured basedon the mongod specification, and the default
specification is free of charge.

ReadonlyNodeNum

ReadonlyNodeAvailabilityZoneList.N

HiddenZone

No

No

No

©2013-2022 Tencent Cloud. All rights reserved.

IntegerNumber of read-only nodes. Value range: 0-5.

Array

AZ of read-only nodes, which is requiredofStringwhen ReadonlyNodeNum is not 0 in

Stringcross-AZ instance deployment.
AZ where the hidden node resides, which is
required in cross-AZ instance deployment.

Page 97 of 190

TencentDB for MongoDB

3. Output Parameters
Parameter
Name

Type

Description

DealIdStringOrder ID

InstanceIds

Array of
StringList of IDs of the created instances

RequestId

String

The unique request ID, which is returned for each request. RequestId is required
for locating a problem.

4. Example
Example1 Creating a pay-as-you-go TencentDB instanceThis example shows you how to create a v4.0 instance. To create instances on other versions, you need to specify theversion as instructed in the input parameter description.
Input Example
POST / HTTP/1.1
Host: mongodb.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateDBInstanceHour<Common request parameters>{"Zone": "ap-guangzhou-3","GoodsNum": "1","Clone": "1","Memory": "4","ClusterType": "REPLSET","Volume": "250","NodeNum": "2","ReplicateSetNum": "1","MachineCode": "HIO10G","MongoVersion": "MONGO_40_WT"}

Output Example©2013-2022 Tencent Cloud. All rights reserved.

Page 98 of 190

TencentDB for MongoDB{"Response": {"RequestId": "eaf9b19d-5ad4-4ca2-9fc4-a319aeb9181f","DealId": "20190709160000003502416120946732","InstanceIds": ["cmgo-m26c6jsf"]}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InvalidParameter

Parameter error

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform
this operation.

©2013-2022 Tencent Cloud. All rights reserved.

Page 99 of 190

TencentDB for MongoDB

InvalidParameterValue.ClusterTypeError

Invalid instance type.

InvalidParameterValue.InvalidTradeOperation

Billing error. Corresponding
purchase/renewal/configuration change operations are
not allowed for the current instance.

InvalidParameterValue.MachineTypeError

Incorrect model.

InvalidParameterValue.MongoVersionError

The instance version is incorrect.

InvalidParameterValue.PasswordRuleFailed

The password is non-compliant.

InvalidParameterValue.PostPaidInstanceBeyondLimit

The number of postpaid instances in a single region
exceeds the limit.

InvalidParameterValue.ProjectNotFoundThe project does not exist.

InvalidParameterValue.RegionError

Invalid region

InvalidParameterValue.ReplicaSetNumError

Incorrect number of replica sets (shards).

InvalidParameterValue.SpecNotOnSale

Incorrect purchasable specification.

InvalidParameterValue.StatusAbnormal

The instance is in a status where operations are notallowed.

InvalidParameterValue.TagNotFoundThe specified tag was not found.

InvalidParameterValue.VpcIdOrSubnetIdNotFoundThe VPC (subnet) was not found.

InvalidParameterValue.ZoneClosed

Instances are not purchasable in this AZ.

InvalidParameterValue.ZoneError

Invalid availability zone

UnsupportedOperation.VersionNotSupport

The current version does not support the operation.

©2013-2022 Tencent Cloud. All rights reserved.

Page 100 of 190

TencentDB for MongoDB

AssignProject：

Last updated 2023-03-20 10:55:17

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to specify the project to which a TencentDB instance belongs.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API: AssignProject.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

Yes

Array
of

List of instance IDs in the format of cmgo-p8vnipr5. It is the same as

NameInstanceIds.N

StringProjectId

Yes

Integerthe instance ID displayed on the TencentDB Console page
Unique ID of an existing project (instead of a new project).

3. Output Parameters
Parameter

Type

Description©2013-2022 Tencent Cloud. All rights reserved.

Page 101 of 190

TencentDB for MongoDB

Name
FlowIds

Array ofInteger

List of the returned async task IDs

RequestId

String

The unique request ID, which is returned for each request. RequestId is required
for locating a problem.

4. Example
Example1 Specifying the project to which an instance belongs
Input Example
https://mongodb.tencentcloudapi.com/?Action=AssignProject&InstanceIds.0=cmgo-eqmoa5sf&ProjectId=12&<Common request parameters>

Output Example{"Response": {"FlowIds": [1081],"RequestId": "8e2a339e-5ba9-4da3-8dc2-65a0a6314811"}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go©2013-2022 Tencent Cloud. All rights reserved.

Page 102 of 190

TencentDB for MongoDB

Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeInvalidParameter.PermissionDenied

Description
The current subaccount has no permission to perform thisoperation.

InvalidParameterValue.LockFailed

Instance lock failed.

InvalidParameterValue.NotFoundInstance

The instance was not found.

InvalidParameterValue.ProjectNotFoundThe project does not exist.

©2013-2022 Tencent Cloud. All rights reserved.

Page 103 of 190

TencentDB for MongoDB

RenewDBInstances：

Last updated 2023-03-20 10:55:13

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to renew a monthly subscription TencentDB instance. Only monthly subscription instances aresupported, while pay-as-you-go instances do not need to be renewed.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter Name

RequiredType

ActionYes

String

VersionYes

StringRegionNo

StringDescription
Common Params. The value used for this
API: RenewDBInstances.
Common Params. The value used for this
API: 2019-07-25.
Common Params. This parameter is not
required for this API.
IDs of one or more instances to be
operated. The value can be obtained from

InstanceIds.N

Yes

Array of String

the InstanceId parameter returnedby the DescribeInstances API. Up
to 100 instances can be requested at atime.

InstanceChargePrepaid

Yes

InstanceChargePrepaid©2013-2022 Tencent Cloud. All rights reserved.

The parameter setting for the prepaid

Page 104 of 190

TencentDB for MongoDB

mode (monthly subscription mode). Thisparameter can specify the renewal period,
whether to set automatic renewal, andother attributes of the monthly subscription
instance. This parameter is mandatory inmonthly subscription.

3. Output Parameters
Parameter
Name

Type

Description

RequestId

String

The unique request ID, which is returned for each request. RequestId is required forlocating a problem.

4. Example
Example1 Renewing monthly-subscribed instances
Input Example
https://mongodb.tencentcloudapi.com/?Action=RenewDBInstances&InstanceIds.0=cmgo-gzo03o75&InstanceChargePrepaid.Period=1&<Common request parameters>

Output Example{"Response": {"RequestId": "b1886334-acfe-4445-8429-e11a6e7b3851"}}

5. Developer Resources
SDK©2013-2022 Tencent Cloud. All rights reserved.

Page 105 of 190

TencentDB for MongoDB

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform thisoperation.

InvalidParameterValue.InvalidTradeOperation

Billing error. Corresponding purchase/renewal/configuration
change operations are not allowed for the current instance.

InvalidParameterValue.NotFoundInstance

The instance was not found.

©2013-2022 Tencent Cloud. All rights reserved.

Page 106 of 190

TencentDB for MongoDB

DescribeSlowLogs：

Last updated 2023-04-06 10:21:25

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to get the slow log information of a TencentDB instance. Only slow logs for the last 7 days can bequeried.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API: DescribeSlowLogs.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

StringName

Instance ID in the format of cmgo-p8vnipr5 , which is the sameas the instance ID displayed on the TencentDB Console page
Start time of slow log in the format of yyyy-mm-dd hh:mm:ss ,StartTime

Yes

Timestampsuch as 2019-06-01 10:00:00. The query time range cannot exceed
24 hours. Only slow logs for the last 7 days can be queried.
End time of slow log in the format of yyyy-mm-dd hh:mm:ss ,EndTimeYes

Timestampsuch as 2019-06-02 12:00:00. The query time range cannot exceed
24 hours. Only slow logs for the last 7 days can be queried.

©2013-2022 Tencent Cloud. All rights reserved.

Page 107 of 190

TencentDB for MongoDB

SlowMS

Yes

IntegerThreshold of slow log execution time in milliseconds. Minimum value:100. Slow logs whose execution time exceeds the threshold will be
returned.

OffsetNo

Integer

Offset. Minimum value: 0. Maximum value: 10000. Default value: 0.

Limit

No

IntegerNumber of entries per page. Minimum value: 1. Maximum value:100. Default value: 20.

FormatNo

StringReturn format of slow log. The original slow log format is returned bydefault, and the format can be set to JSON on versions 4.4 and later.

3. Output Parameters
Parameter
Name
Count
SlowLogs

RequestId

Type

Description

Integer

Total number of slow logs

Array of
StringStringSlow log details
The unique request ID, which is returned for each request. RequestId is required
for locating a problem.

4. Example
Example1 Getting the slow log information of an instanceThis example shows you how to get the slow log information of an instance.
Input Example
POST / HTTP/1.1
Host: mongodb.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeSlowLogs<Common request parameters>{"InstanceId": "abc","StartTime": "2020-09-22 00:00:00","EndTime": "2020-09-22 00:00:00",©2013-2022 Tencent Cloud. All rights reserved.

Page 108 of 190

TencentDB for MongoDB"SlowMS": 1,"Offset": 1,"Limit": 1,"Format": "abc"}

Output Example{"Response": {"Count": 20,"RequestId": "3a36aa6e-67e2-42a9-adfe-fc694334cc78","SlowLogs": ["Mon Apr 20 13:55:21.623 I COMMAND [conn16903] command admin.$cmd command: _flush
RoutingTableCacheUpdates { forceRoutingTableRefresh: \"config.system.sessions\",maxTimeMS: 30000, $clusterTime: { clusterTime: Timestamp(1587362114, 1), signatur
e: { hash: BinData(0, 259955995BDC7E0CA35C4276EB23341C03910A48), keyId: 681761394
9303783443 } }, $configServerState: { opTime: { ts: Timestamp(1587362108, 1), t:
1 } }, $db: \"admin\" } numYields:0 reslen:288 locks:{ Global: { acquireCount: {r: 4 } }, Database: { acquireCount: { r: 2 } }, Collection: { acquireCount: { r:2 } } } protocol:op_msg 5335ms","Mon Apr 20 14:01:00.309 I COMMAND [conn1313] command admin.$cmd command: _flushR
outingTableCacheUpdates { forceRoutingTableRefresh: \"config.system.sessions\", maxTimeMS: 30000, $clusterTime: { clusterTime: Timestamp(1587362457, 1), signatur
e: { hash: BinData(0, DC2B16681C70845D7B6C8C6C97400D4DFB394CA0), keyId: 681761394
9303783443 } }, $configServerState: { opTime: { ts: Timestamp(1587362455, 1), t:
1 } }, $db: \"admin\" } numYields:0 reslen:288 locks:{ Global: { acquireCount: {r: 4 } }, Database: { acquireCount: { r: 2 } }, Collection: { acquireCount: { r:2 } } } protocol:op_msg 1264ms","Mon Apr 20 14:20:15.283 I COMMAND [conn586] command admin.$cmd command: _flushRoutingTableCacheUpdates { forceRoutingTableRefresh: \"config.system.sessions\", maxTimeMS: 30000, $clusterTime: { clusterTime: Timestamp(1587363613, 1), signature:{ hash: BinData(0, 72D24884320C8A9A26AF8C4DD1127874085DFAE5), keyId: 681761394930
3783443 } }, $configServerState: { opTime: { ts: Timestamp(1587363603, 1), t: 1 }}, $db: \"admin\" } numYields:0 reslen:288 locks:{ Global: { acquireCount: { r: 4} }, Database: { acquireCount: { r: 2 } }, Collection: { acquireCount: { r: 2 } }} protocol:op_msg 426ms","Mon Apr 20 10:25:45.487 I COMMAND [conn48] command local.system.replset command:
replSetReconfig { replSetReconfig: { _id: \"cmgo-a3bm93hf_1\", version: 3, protoc
olVersion: 1, members: [ { _id: 1, host: \"100.93.44.85:7005\", arbiterOnly: false, buildIndexes: true, hidden: false, priority: 1.0, slaveDelay: 0, votes: 1 }, {_id: 2, host: \"10.112.91.43:7009\", arbiterOnly: false, buildIndexes: true, hidd
en: false, priority: 1.0, slaveDelay: 0, votes: 1 }, { _id: 3, host: \"10.53.61.2
4:7004\" } ], settings: { chainingAllowed: true, heartbeatIntervalMillis: 2000, heartbeatTimeoutSecs: 10, electionTimeoutMillis: 10000, catchUpTimeoutMillis: -1,
catchUpTakeoverDelayMillis: 30000, getLastErrorDefaults: { wtimeout: 0, w: 1 }, r©2013-2022 Tencent Cloud. All rights reserved.

Page 109 of 190

TencentDB for MongoDB

eplicaSetId: ObjectId('5e9d08160c269352426f9575') } }, $db: \"admin\" } numYields:0 reslen:60 locks:{ Global: { acquireCount: { r: 3, w: 2, W: 1 } }, Database: {acquireCount: { w: 1, W: 1 } }, oplog: { acquireCount: { w: 1 } } } protocol:op_q
uery 423ms","Mon Apr 20 10:25:34.934 I COMMAND [conn28] command local.system.replset command:
replSetReconfig { replSetReconfig: { _id: \"cmgo-a3bm93hf_1\", version: 2, protoc
olVersion: 1, members: [ { _id: 1, host: \"100.93.44.85:7005\", arbiterOnly: false, buildIndexes: true, hidden: false, priority: 1.0, slaveDelay: 0, votes: 1 }, {_id: 2, host: \"10.112.91.43:7009\" } ], settings: { chainingAllowed: true, heart
beatIntervalMillis: 2000, heartbeatTimeoutSecs: 10, electionTimeoutMillis: 10000,
catchUpTimeoutMillis: -1, catchUpTakeoverDelayMillis: 30000, getLastErrorDefaults: { w: 1, wtimeout: 0 }, replicaSetId: ObjectId('5e9d08160c269352426f9575') } },$db: \"admin\" } numYields:0 reslen:60 locks:{ Global: { acquireCount: { r: 3, w:
2, W: 1 } }, Database: { acquireCount: { w: 1, W: 1 } }, oplog: { acquireCount: {w: 1 } } } protocol:op_query 414ms","Mon Apr 20 10:24:52.278 I COMMAND [conn30] command local.system.replset command:
replSetReconfig { replSetReconfig: { _id: \"cmgo-a3bm93hf_0\", version: 2, protoc
olVersion: 1, members: [ { _id: 1, host: \"10.53.80.6:7011\", arbiterOnly: false,buildIndexes: true, hidden: false, priority: 1.0, slaveDelay: 0, votes: 1 }, { _id: 2, host: \"100.93.44.26:7012\" } ], settings: { chainingAllowed: true, heartbe
atIntervalMillis: 2000, heartbeatTimeoutSecs: 10, electionTimeoutMillis: 10000, c
atchUpTimeoutMillis: -1, catchUpTakeoverDelayMillis: 30000, getLastErrorDefaults:{ w: 1, wtimeout: 0 }, replicaSetId: ObjectId('5e9d07ebf3f99b58c95a33fb') } }, $db: \"admin\" } numYields:0 reslen:60 locks:{ Global: { acquireCount: { r: 3, w:
2, W: 1 } }, Database: { acquireCount: { w: 1, W: 1 } }, oplog: { acquireCount: {w: 1 } } } protocol:op_query 406ms","Mon Apr 20 10:25:02.675 I COMMAND [conn50] command local.system.replset command:
replSetReconfig { replSetReconfig: { _id: \"cmgo-a3bm93hf_0\", version: 3, protoc
olVersion: 1, members: [ { _id: 1, host: \"10.53.80.6:7011\", arbiterOnly: false,buildIndexes: true, hidden: false, priority: 1.0, slaveDelay: 0, votes: 1 }, { _id: 2, host: \"100.93.44.26:7012\", arbiterOnly: false, buildIndexes: true, hidde
n: false, priority: 1.0, slaveDelay: 0, votes: 1 }, { _id: 3, host: \"9.34.46.139:7003\" } ], settings: { chainingAllowed: true, heartbeatIntervalMillis: 2000, he
artbeatTimeoutSecs: 10, electionTimeoutMillis: 10000, catchUpTimeoutMillis: -1, c
atchUpTakeoverDelayMillis: 30000, getLastErrorDefaults: { w: 1, wtimeout: 0 }, replicaSetId: ObjectId('5e9d07ebf3f99b58c95a33fb') } }, $db: \"admin\" } numYields:
0 reslen:60 locks:{ Global: { acquireCount: { r: 3, w: 2, W: 1 } }, Database: { acquireCount: { w: 1, W: 1 } }, oplog: { acquireCount: { w: 1 } } } protocol:op_qu
ery 373ms","Mon Apr 20 18:35:15.103 I COMMAND [conn586] command admin.$cmd command: _flushRoutingTableCacheUpdates { forceRoutingTableRefresh: \"config.system.sessions\", maxTimeMS: 30000, $clusterTime: { clusterTime: Timestamp(1587378913, 1), signature:{ hash: BinData(0, A3C176F81B64A7473F88F3F40B84C59EC9E1E1AE), keyId: 681761394930
3783443 } }, $configServerState: { opTime: { ts: Timestamp(1587378912, 1), t: 2 }}, $db: \"admin\" } numYields:0 reslen:288 locks:{ Global: { acquireCount: { r: 4} }, Database: { acquireCount: { r: 2 } }, Collection: { acquireCount: { r: 2 } }} protocol:op_msg 248ms",©2013-2022 Tencent Cloud. All rights reserved.

Page 110 of 190

TencentDB for MongoDB"Mon Apr 20 10:27:38.171 I COMMAND [conn281] command admin.$cmd command: setFeatu
reCompatibilityVersion { setFeatureCompatibilityVersion: \"4.0\", $db: \"admin\"} numYields:0 reslen:288 locks:{ Global: { acquireCount: { r: 5, w: 4, R: 1 } },Database: { acquireCount: { w: 2, W: 2 } }, Collection: { acquireCount: { w: 2 }}, Mutex: { acquireCount: { W: 1 } }, oplog: { acquireCount: { w: 2 } } } protoco
l:op_msg 212ms","Mon Apr 20 10:26:27.924 I COMMAND [conn111] command local.system.replset comman
d: replSetReconfig { replSetReconfig: { _id: \"cmgo-a3bm93hf_2\", version: 3, pro
tocolVersion: 1, members: [ { _id: 1, host: \"10.112.90.165:7002\", arbiterOnly:
false, buildIndexes: true, hidden: false, priority: 1.0, slaveDelay: 0, votes: 1}, { _id: 2, host: \"10.53.80.6:7012\", arbiterOnly: false, buildIndexes: true, hidden: false, priority: 1.0, slaveDelay: 0, votes: 1 }, { _id: 3, host: \"100.93.
44.26:7013\" } ], settings: { chainingAllowed: true, heartbeatIntervalMillis: 200
0, heartbeatTimeoutSecs: 10, electionTimeoutMillis: 10000, catchUpTimeoutMillis:-1, catchUpTakeoverDelayMillis: 30000, getLastErrorDefaults: { w: 1, wtimeout: 0}, replicaSetId: ObjectId('5e9d0841f0f688fc992fd087') } }, $db: \"admin\" } numYi
elds:0 reslen:60 locks:{ Global: { acquireCount: { r: 3, w: 2, W: 1 } }, Database: { acquireCount: { w: 1, W: 1 } }, oplog: { acquireCount: { w: 1 } } } protoco
l:op_query 212ms","Mon Apr 20 13:55:15.051 I COMMAND [conn586] command admin.$cmd command: _flushRoutingTableCacheUpdates { forceRoutingTableRefresh: \"config.system.sessions\", maxTimeMS: 30000, $clusterTime: { clusterTime: Timestamp(1587362114, 1), signature:{ hash: BinData(0, 259955995BDC7E0CA35C4276EB23341C03910A48), keyId: 681761394930
3783443 } }, $configServerState: { opTime: { ts: Timestamp(1587362085, 6), t: 1 }}, $db: \"admin\" } numYields:0 reslen:288 locks:{ Global: { acquireCount: { r: 4} }, Database: { acquireCount: { r: 2 } }, Collection: { acquireCount: { r: 2 } }} protocol:op_msg 192ms","Mon Apr 20 10:27:39.400 I COMMAND [conn213] command admin.$cmd command: setFeatu
reCompatibilityVersion { setFeatureCompatibilityVersion: \"4.0\", $db: \"admin\"} numYields:0 reslen:288 locks:{ Global: { acquireCount: { r: 5, w: 4, R: 1 } },Database: { acquireCount: { w: 2, W: 2 } }, Collection: { acquireCount: { w: 2 }}, Mutex: { acquireCount: { W: 1 } }, oplog: { acquireCount: { w: 2 } } } protoco
l:op_msg 183ms","Mon Apr 20 10:26:09.357 I COMMAND [conn36] command local.system.replset command:
replSetInitiate { replSetInitiate: { _id: \"cmgo-a3bm93hf_2\", version: 1, members: [ { _id: 1, host: \"10.112.90.165:7002\" } ] }, $readPreference: { mode: \"sec
ondaryPreferred\" }, $db: \"admin\" } numYields:0 reslen:60 locks:{ Global: { acquireCount: { r: 23, w: 7, W: 2 }, acquireWaitCount: { W: 1 }, timeAcquiringMicros: { W: 59 } }, Database: { acquireCount: { r: 7, w: 4, W: 3 } }, Collection: { acquireCount: { r: 3, w: 2 } }, oplog: { acquireCount: { r: 2, w: 3 } } } protoco
l:op_query 134ms","Mon Apr 20 13:00:16.363 I COMMAND [conn16903] command admin.$cmd command: _flush
RoutingTableCacheUpdates { forceRoutingTableRefresh: \"config.system.sessions\",maxTimeMS: 30000, $clusterTime: { clusterTime: Timestamp(1587358814, 1), signatur
e: { hash: BinData(0, 90BD7BB9B481B9825527D89A3579B52E6C0C3915), keyId: 681761394
9303783443 } }, $configServerState: { opTime: { ts: Timestamp(1587358809, 2), t:
1 } }, $db: \"admin\" } numYields:0 reslen:288 locks:{ Global: { acquireCount: {©2013-2022 Tencent Cloud. All rights reserved.

Page 111 of 190

TencentDB for MongoDB

r: 4 } }, Database: { acquireCount: { r: 2 } }, Collection: { acquireCount: { r:2 } } } protocol:op_msg 123ms","Mon Apr 20 13:35:14.983 I COMMAND [conn586] command admin.$cmd command: _flushRoutingTableCacheUpdates { forceRoutingTableRefresh: \"config.system.sessions\", maxTimeMS: 30000, $clusterTime: { clusterTime: Timestamp(1587360912, 1), signature:{ hash: BinData(0, 06A84575A66B9316D1ECBFB9FB1C7B2F605AB3A8), keyId: 681761394930
3783443 } }, $configServerState: { opTime: { ts: Timestamp(1587360909, 5), t: 1 }}, $db: \"admin\" } numYields:0 reslen:288 locks:{ Global: { acquireCount: { r: 4} }, Database: { acquireCount: { r: 2 } }, Collection: { acquireCount: { r: 2 } }} protocol:op_msg 122ms","Mon Apr 20 10:24:43.760 I COMMAND [conn16] command local.system.replset command:
replSetInitiate { replSetInitiate: { _id: \"cmgo-a3bm93hf_0\", version: 1, members: [ { _id: 1, host: \"10.53.80.6:7011\" } ] }, $readPreference: { mode: \"second
aryPreferred\" }, $db: \"admin\" } numYields:0 reslen:60 locks:{ Global: { acquireCount: { r: 23, w: 7, W: 2 }, acquireWaitCount: { W: 1 }, timeAcquiringMicros: {W: 39 } }, Database: { acquireCount: { r: 7, w: 4, W: 3 } }, Collection: { acquireCount: { r: 3, w: 2 } }, oplog: { acquireCount: { r: 2, w: 3 } } } protocol:op_q
uery 112ms","Mon Apr 20 10:25:26.300 I COMMAND [conn15] command local.system.replset command:
replSetInitiate { replSetInitiate: { _id: \"cmgo-a3bm93hf_1\", version: 1, members: [ { _id: 1, host: \"100.93.44.85:7005\" } ] }, $readPreference: { mode: \"secondaryPreferred\" }, $db: \"admin\" } numYields:0 reslen:60 locks:{ Global: { acqu
ireCount: { r: 23, w: 7, W: 2 }, acquireWaitCount: { W: 1 }, timeAcquiringMicros:{ W: 24 } }, Database: { acquireCount: { r: 7, w: 4, W: 3 }, acquireWaitCount: {W: 1 }, timeAcquiringMicros: { W: 7 } }, Collection: { acquireCount: { r: 3, w: 2} }, oplog: { acquireCount: { r: 2, w: 3 } } } protocol:op_query 110ms","Mon Apr 20 10:27:39.400 I COMMAND [conn213] command admin.$cmd command: update {update: \"system.version\", writeConcern: { w: \"majority\" }, $db: \"admin\" } numYields:0 reslen:370 locks:{ Global: { acquireCount: { r: 5, w: 4, R: 1 } }, Database: { acquireCount: { w: 2, W: 2 } }, Collection: { acquireCount: { w: 2 } },Mutex: { acquireCount: { W: 1 } }, oplog: { acquireCount: { w: 2 } } } protocol:op_msg 107ms","Mon Apr 20 10:27:38.065 I COMMAND [conn281] command admin.$cmd command: update {update: \"system.version\", writeConcern: { w: \"majority\" }, $db: \"admin\" } numYields:0 reslen:370 locks:{ Global: { acquireCount: { r: 2, w: 2 } }, Database:{ acquireCount: { w: 1, W: 1 } }, Collection: { acquireCount: { w: 1 } }, Mutex:{ acquireCount: { W: 1 } }, oplog: { acquireCount: { w: 1 } } } protocol:op_msg 1
07ms","Mon Apr 20 10:27:38.170 I COMMAND [conn281] command admin.$cmd command: update {update: \"system.version\", writeConcern: { w: \"majority\" }, $db: \"admin\" } numYields:0 reslen:370 locks:{ Global: { acquireCount: { r: 5, w: 4, R: 1 } }, Database: { acquireCount: { w: 2, W: 2 } }, Collection: { acquireCount: { w: 2 } },Mutex: { acquireCount: { W: 1 } }, oplog: { acquireCount: { w: 2 } } } protocol:op_msg 105ms"]}}©2013-2022 Tencent Cloud. All rights reserved.

Page 112 of 190

TencentDB for MongoDB

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InvalidParameter

Parameter error

InvalidParameter.PermissionDenied
InvalidParameterValue.NotFoundInstance
InvalidParameterValue.QueryTimeOutOfRange

InvalidParameterValue.QueryTimeRangeBeyondLimit©2013-2022 Tencent Cloud. All rights reserved.

The current subaccount has no permission to
perform this operation.
The instance was not found.
Only slow logs generated in the past seven days
can be queried.
Only slow logs generated in the past seven days
can be queried.

Page 113 of 190

TencentDB for MongoDB

InvalidParameterValue.SlowMSBelowLimit

The value of the slowMS parameter should be
at least 100 ms.

InvalidParameterValue.StartTimeNotBeforeThanEndTime©2013-2022 Tencent Cloud. All rights reserved.

The start time should be earlier than the end time.

Page 114 of 190

TencentDB for MongoDB

DescribeSlowLogPatterns：

Last updated 2023-03-20 10:55:16

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to get the slow log statistics of a database instance.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API:
DescribeSlowLogPatterns.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

StringName

Instance ID in the format of cmgo-p8vnipr5 , which is the sameas the instance ID displayed on the TencentDB Console page
Start time of slow log in the format of yyyy-mm-dd hh:mm:ss ,StartTime

Yes

Timestampsuch as 2019-06-01 10:00:00. The query time range cannot exceed
24 hours. Only slow logs for the last 7 days can be queried.
End time of slow log in the format of yyyy-mm-dd hh:mm:ss ,EndTimeYes

Timestampsuch as 2019-06-02 12:00:00. The query time range cannot exceed
24 hours. Only slow logs for the last 7 days can be queried.

©2013-2022 Tencent Cloud. All rights reserved.

Page 115 of 190

TencentDB for MongoDB

SlowMS

Yes

IntegerThreshold of slow log execution time in milliseconds. Minimum value:100. Slow logs whose execution time exceeds the threshold will be
returned.

OffsetNo

Integer

Limit

No

IntegerFormatNo

StringOffset. Minimum value: 0. Maximum value: 10000. Default value: 0.
Number of entries per page. Minimum value: 1. Maximum value:100. Default value: 20.
Slow log format, which can be JSON. If this parameter is left empty,
the slow log will be returned in its native format.

3. Output Parameters
Parameter NameType

Description

Count

Integer

Total number of slow logs

SlowLogPatterns

Array of
SlowLogPattern

Slow log statistics

RequestId

String

The unique request ID, which is returned for each request. RequestId
is required for locating a problem.

4. Example
Example1 Querying the slow log statistics of database
Input Example
https://mongodb.tencentcloudapi.com/?Action=DescribeSlowLogPatterns&InstanceId=cmgo-a3bm93hf&StartTime=2020-04-20 00:00:00&EndTime=2020-04-20 22:00:00&SlowMS=100&Offset=0&Limit=100&<Common request parameters>

Output Example©2013-2022 Tencent Cloud. All rights reserved.

Page 116 of 190

TencentDB for MongoDB{"Response": {"Count": 2,"RequestId": "895de939-f726-4cb0-bb02-3890289479e3","SlowLogPatterns": [{"AverageTime": 699,
"MaxTime": 5335,"Pattern": "admin.$cmd.command","Total": 12},{"AverageTime": 271,
"MaxTime": 423,
"Pattern": "local.system.replset.command","Total": 8}]}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error Code©2013-2022 Tencent Cloud. All rights reserved.

Page 117 of 190

TencentDB for MongoDB

The following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InvalidParameter

Parameter error

InvalidParameter.PermissionDenied
InvalidParameterValue.NotFoundInstance
InvalidParameterValue.QueryTimeOutOfRange

InvalidParameterValue.QueryTimeRangeBeyondLimit

InvalidParameterValue.SlowMSBelowLimit
InvalidParameterValue.StartTimeNotBeforeThanEndTime©2013-2022 Tencent Cloud. All rights reserved.

The current subaccount has no permission to
perform this operation.
The instance was not found.
Only slow logs generated in the past seven days
can be queried.
Only slow logs generated in the past seven days
can be queried.
The value of the slowMS parameter should be
at least 100 ms.
The start time should be earlier than the end time.

Page 118 of 190

TencentDB for MongoDB

InquirePriceRenewDBInstances：

Last updated 2023-03-20 10:55:14

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to query the renewal price of a monthly subscription instance.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter Name

RequiredType

ActionYes

String

VersionYes

StringRegionNo

StringDescription
Common Params. The value used for this
API: InquirePriceRenewDBInstances.
Common Params. The value used for this
API: 2019-07-25.
Common Params. This parameter is not
required for this API.
Instance ID in the format of cmgo-

InstanceIds.N

Yes

Array of String

p8vnipr5. It is the same as the instance ID
displayed in the TencentDB Console. This
API supports operations on up to 5
instances at a time.

InstanceChargePrepaid

Yes

InstanceChargePrepaid

The parameter setting for the prepaid
mode (monthly subscription mode). Thisparameter can specify the renewal period,
whether to set automatic renewal, and©2013-2022 Tencent Cloud. All rights reserved.

Page 119 of 190

TencentDB for MongoDB

other attributes of the monthly subscription
instance.

3. Output Parameters
Parameter
Name

Type

Description

Price

DBInstancePrice

Price.

RequestId

String

The unique request ID, which is returned for each request. RequestId isrequired for locating a problem.

4. Example
Example1 Querying the renewal price of an instance
Input Example
https://mongodb.tencentcloudapi.com/?Action=InquirePriceRenewDBInstances&InstanceIds.0=cmgo-8oij5631&InstanceChargePrepaid.Period=1&<Common request parameters>

Output Example{"Response": {"Price": {"DiscountPrice": 455.6,"OriginalPrice": 670,
"UnitPrice": 0},"RequestId": "d08f2a0f-4a69-451e-8ddb-753340d5fb34"}}

5. Developer Resources©2013-2022 Tencent Cloud. All rights reserved.

Page 120 of 190

TencentDB for MongoDB

SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InternalError.FindInstanceFailed

Failed to query the instance.

InvalidParameter

Parameter error

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform this operation.

InvalidParameterValue.ZoneClosed

Instances are not purchasable in this AZ.

©2013-2022 Tencent Cloud. All rights reserved.

Page 121 of 190

TencentDB for MongoDB

InquirePriceModifyDBInstanceSpec：

Last updated 2023-04-06 10:21:24

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to query the price of instance specification adjustment.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter Name

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API:
InquirePriceModifyDBInstanceSpec.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

StringMemoryYes

Integer

Instance memory size in GB after specification adjustment.

VolumeYes

Integer

Instance disk size in GB after specification adjustment.

NodeNum

No

Integer

ReplicateSetNum

No

Integer©2013-2022 Tencent Cloud. All rights reserved.

Instance ID in the format of cmgo-p8vn****. It is the same as theinstance ID displayed in the TencentDB console.

Number of instance nodes. The number of nodes is left
unchanged by default and cannot be changed currently.
Number of instance shards. The number of shards is left
unchanged by default and cannot be changed currently.

Page 122 of 190

TencentDB for MongoDB

3. Output Parameters
Parameter

Type

Description

Price

DBInstancePrice

Price.

RequestId

StringName

The unique request ID, which is returned for each request. RequestId isrequired for locating a problem.

4. Example
Example1 Querying the price of a specified instance after adjustment
This example shows you how to query the price of a specified instance after adjustment.
Input Example
https://mongodb.tencentcloudapi.com/?Action=InquirePriceModifyDBInstanceSpec&InstanceId=cmgo-8oij5631&Memory=8&Volume=200&<Common request parameters>

Output Example{"Response": {"Price": {"DiscountPrice": 449.36,"OriginalPrice": 660.82,"UnitPrice": 0},"RequestId": "ac618a97-5a29-4003-8489-fd8a1e1cc8e9"}}

5. Developer Resources
SDK©2013-2022 Tencent Cloud. All rights reserved.

Page 123 of 190

TencentDB for MongoDB

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError.FindInstanceFailed

Failed to query the instance.

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform this operation.

InvalidParameterValue.ZoneClosed

Instances are not purchasable in this AZ.

©2013-2022 Tencent Cloud. All rights reserved.

Page 124 of 190

TencentDB for MongoDB

InquirePriceCreateDBInstances：

Last updated 2023-03-20 10:55:15

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to query price of instance creation. The region parameter must be passed in this API, otherwise
verification will fail. This API allows queries only for purchasable instance specifications.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter Name

RequiredType

ActionYes

String

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

Zone

Yes

String

Instance region name in the format of ap-guangzhou-2.

NodeNum

Yes

Integer

Description
Common Params. The value used for this API:
InquirePriceCreateDBInstances.

Number of primary and secondary nodes per shard.
Value range: It can be queried by the DescribeSpecInfo API,and the MinNodeNum and MaxNodeNum parameters
are the minimal and maximum value respectively.

MemoryYes

Integer

Instance memory size in GB.

VolumeYes

Integer

Instance disk size.
Unit: GB©2013-2022 Tencent Cloud. All rights reserved.

Page 125 of 190

TencentDB for MongoDB

Value range: It can be queried by the DescribeSpecInfo
API, and MinStorage and MaxStorage
parameters are the minimal and maximum value of the disk
size respectively.

Instance version information.
For specific supported versions, query through the
DescribeSpecInfo API, the returned parameter
MongoVersionCode in data structure SpecItems
is the supported version information.
The correspondences between parameters and versions
are as follows
MONGO_3_WT: MongoDB 3.2 WiredTiger storage

MongoVersion

Yes

Stringengine version.
MONGO_3_ROCKS: MongoDB 3.2 RocksDB storageengine version.
MONGO_36_WT: MongoDB 3.6 WiredTiger storageengine version.
MONGO_40_WT: MongoDB 4.0 WiredTiger storageengine version.
MONGO_42_WT: MongoDB 4.2 WiredTiger storageengine version.
MONGO_44_WT: MongoDB 4.4 WiredTiger storageengine version.

Server type. Valid values: HIO (high IO), HIO10G (ten-MachineCode

Yes

StringGoodsNum

Yes

IntegerNumber of instances. Minimum value: 1. Maximum value: 10.

ClusterType

Yes

String

Instance type. Valid values: REPLSET (replica set), SHARD(sharded cluster), STANDALONE (single-node).

ReplicateSetNum

Yes

Integergigabit high IO)

Number of replica sets. To create a replica set instance, set
this parameter to 1; to create a shard instance, see theparameters returned by the DescribeSpecInfo API; tocreate a single-node instance, set this parameter to 0.

PeriodNo

Integer

InstanceChargeType

No

StringMongosCpu

No

Integer©2013-2022 Tencent Cloud. All rights reserved.

Instance validity period in months. Valid values: 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 24, 36.

Page 126 of 190

TencentDB for MongoDB

MongosMemory

No

Integer

MongosNum

No

Integer

ConfigServerCpu

No

Integer

ConfigServerMemory

No

Integer

ConfigServerVolume

No

Integer

3. Output Parameters
Parameter
Name

Type

Description

Price

DBInstancePrice

Price.

RequestId

String

The unique request ID, which is returned for each request. RequestId isrequired for locating a problem.

4. Example
Example1 Querying purchase price of an instance
Input Example
https://mongodb.tencentcloudapi.com/?Action=InquirePriceCreateDBInstances&Zone=ap-guangzhou-4&NodeNum=3&Memory=4&Volume=100&MongoVersion=MONGO_36_WT&MachineCode=HIO10G&GoodsNum=2&Period=1&ClusterType=REPLSET&ReplicateSetNum=1&<Common request parameters>

Output Example©2013-2022 Tencent Cloud. All rights reserved.

Page 127 of 190

TencentDB for MongoDB{"Response": {"Price": {"DiscountPrice": 1340,"OriginalPrice": 1340,"UnitPrice": 670},"RequestId": "fb8b4646-389d-44cc-ab8c-98c081cbdad3"}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InvalidParameter

Parameter error©2013-2022 Tencent Cloud. All rights reserved.

Page 128 of 190

TencentDB for MongoDB

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform thisoperation.

InvalidParameterValue.MachineTypeError

Incorrect model.

InvalidParameterValue.MongoVersionError

The instance version is incorrect.

InvalidParameterValue.ReplicaSetNumError

Incorrect number of replica sets (shards).

InvalidParameterValue.SpecNotOnSale

Incorrect purchasable specification.

InvalidParameterValue.ZoneClosed

Instances are not purchasable in this AZ.

InvalidParameterValue.ZoneError

Invalid availability zone

©2013-2022 Tencent Cloud. All rights reserved.

Page 129 of 190

TencentDB for MongoDB

DescribeDBInstanceDeal：

Last updated 2023-03-20 10:55:17

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to get details of purchase, renewal, and specification adjustment orders of a MongoDB instance.
A maximum of 5 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter
Name

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API:
DescribeDBInstanceDeal.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

DealIdYesStringOrder ID. It is returned by the CreateDBInstance and otherAPIs.

3. Output Parameters
Parameter
Name

Type

Description©2013-2022 Tencent Cloud. All rights reserved.

Page 130 of 190

TencentDB for MongoDB

StatusInteger

Order status. Valid values: 1 (unpaid), 2 (paid), 3 (delivering), 4 (delivered), 5(delivery failed), 6 (refunded), 7 (order closed), 8 (order closed because it failed tobe paid within timeout period).

OriginalPrice

Float

Original price of the order.

DiscountPrice

Float

Discounted price of the order.

ActionStringRequestId

StringOperation performed by the order. Valid values: purchase, renew, upgrade,downgrade, refund.
The unique request ID, which is returned for each request. RequestId is required
for locating a problem.

4. Example
Example1 Querying order details
Input Example
https://mongodb.tencentcloudapi.com/?Action=DescribeDBInstanceDeal&DealId=20200420111635&<Common request parameters>

Output Example{"Response": {"Action": "purchase","DiscountPrice": 759.33,"OriginalPrice": 1116.67,"RequestId": "e79836e8-1864-45bf-aa63-0c7af31e7de5","Status": 4}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to callAPIs.

©2013-2022 Tencent Cloud. All rights reserved.

Page 131 of 190

TencentDB for MongoDB

Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InvalidParameter

Parameter error

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform this operation.

©2013-2022 Tencent Cloud. All rights reserved.

Page 132 of 190

TencentDB for MongoDB

DescribeSecurityGroup：

Last updated 2023-03-20 10:55:16

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to query the security groups associated with an instance.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter
Name

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API:
DescribeSecurityGroup.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

String

Instance ID in the format of "cmgo-p8vnipr5"

3. Output Parameters
Parameter
Name

Type

Description

GroupsArray of

Security groups associated with the instance©2013-2022 Tencent Cloud. All rights reserved.

Page 133 of 190

TencentDB for MongoDB

SecurityGroup
RequestId

String

The unique request ID, which is returned for each request. RequestId isrequired for locating a problem.

4. Example
Example1 Querying the security groups associated with an instance
Input Example
https://mongodb.tencentcloudapi.com/?Action=DescribeSecurityGroup&InstanceId=cmgo-p8vnipr5&<Common request parameters>

Output Example{"Response": {"RequestId": "xx","Groups": [{"Outbound": [{"PortRange": "xx","CidrIp": "xx","ServiceModule": "xx","AddressModule": "xx","Action": "xx","IpProtocol": "xx","Id": "xx","Desc": "xx"},{"PortRange": "xx","CidrIp": "xx","Action": "xx","AddressModule": "xx","ServiceModule": "xx","IpProtocol": "xx","Id": "xx","Desc": "xx"}],©2013-2022 Tencent Cloud. All rights reserved.

Page 134 of 190

TencentDB for MongoDB"SecurityGroupName": "xx","Inbound": [{"PortRange": "xx","CidrIp": "xx","ServiceModule": "xx","AddressModule": "xx","Action": "xx","IpProtocol": "xx","Id": "xx","Desc": "xx"},{"PortRange": "xx","CidrIp": "xx","Action": "xx","AddressModule": "xx","ServiceModule": "xx","IpProtocol": "xx","Id": "xx","Desc": "xx"}],
"ProjectId": 0,"SecurityGroupId": "xx","SecurityGroupRemark": "xx","CreateTime": "xx"}]}}5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS©2013-2022 Tencent Cloud. All rights reserved.

Page 135 of 190

TencentDB for MongoDB

Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InvalidParameter

Parameter error

InvalidParameter.PermissionDenied
InvalidParameterValue.NotFoundInstance©2013-2022 Tencent Cloud. All rights reserved.

The current subaccount has no permission to perform thisoperation.
The instance was not found.

Page 136 of 190

TencentDB for MongoDB

DescribeInstanceParams：

Last updated 2023-03-20 10:55:16

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to query the modifiable parameter list of an instance.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter

RequiredType

ActionYes

String

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

String

Instance ID

Name

Description
Common Params. The value used for this API:
DescribeInstanceParams.

3. Output Parameters
Parameter NameType

Description

InstanceEnumParam

Array of
InstanceEnumParam

The collection of enum parameters©2013-2022 Tencent Cloud. All rights reserved.

Page 137 of 190

TencentDB for MongoDB

InstanceIntegerParam

Array ofThe collection of integer parameters

InstanceIntegerParam
InstanceTextParam

Array of
InstanceTextParam

The collection of text parameters

InstanceMultiParam

Array of
InstanceMultiParam

The collection of string parameters used to represent time
rangesTotalCount

Integer

The total number of modifiable parameters of the instance,such as 0

RequestId

String

The unique request ID, which is returned for each request.
RequestId is required for locating a problem.

4. Example
Example1 InstanceEnumParamThis example shows you how to query the modifiable parameter list of a MongoDB instance.
Input Example
POST / HTTP/1.1
Host: mongodb.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeInstanceParams<Common request parameters>{"InstanceId": "jyjcw8yv"}

Output Example{"Response": {"InstanceEnumParam": [{"Status": 1,"CurrentValue": "xx","DefaultValue": "xx","NeedRestart": "xx","EnumValue": [©2013-2022 Tencent Cloud. All rights reserved.

Page 138 of 190

TencentDB for MongoDB"xx"],"ParamName": "xx","Tips": ["xx"],"ValueType": "xx"}],"InstanceTextParam": [{"Status": "xx","CurrentValue": "xx","DefaultValue": "xx","NeedRestart": "xx","ParamName": "xx","Tips": ["xx"],"TextValue": "xx","ValueType": "xx"}],
"TotalCount": 1,"RequestId": "xx","InstanceIntegerParam": [{"Status": 1,"CurrentValue": "xx","Min": "xx","Max": "xx","DefaultValue": "xx","NeedRestart": "xx","ParamName": "xx","Tips": ["xx"],"ValueType": "xx","Unit": "xx"}],"InstanceMultiParam": [{"Status": 1,"CurrentValue": "xx","DefaultValue": "xx","NeedRestart": "xx",©2013-2022 Tencent Cloud. All rights reserved.

Page 139 of 190

TencentDB for MongoDB"EnumValue": ["xx"],"ParamName": "xx","Tips": ["xx"],"ValueType": "xx"}]}}5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error©2013-2022 Tencent Cloud. All rights reserved.

Page 140 of 190

TencentDB for MongoDB

InvalidParameter
InvalidParameter.CurrentInstanceNotSupportModifyParams

Parameter error
The instance does not support parametersetting.

InvalidParameter.PermissionDenied

The current subaccount has no permission to
perform this operation.

InvalidParameterValue.NotFoundInstance

The instance was not found.

ResourceNotFoundThe resource does not exist.

©2013-2022 Tencent Cloud. All rights reserved.

Page 141 of 190

TencentDB for MongoDB

ModifyDBInstanceSecurityGroup：

Last updated 2023-04-06 10:21:24

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to modify the security groups associated with an instance.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter Name

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API:
ModifyDBInstanceSecurityGroup.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for thisAPI.

InstanceId

Yes

String

Instance ID

SecurityGroupIds.N

Yes

Array of
StringTarget security group IDs

3. Output Parameters
Parameter

Type

Description©2013-2022 Tencent Cloud. All rights reserved.

Page 142 of 190

TencentDB for MongoDB

Name
RequestId

String

The unique request ID, which is returned for each request. RequestId is required forlocating a problem.

4. Example
Example1 Modifying security group information of an instance
Input Example
POST / HTTP/1.1
Host: mongodb.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyDBInstanceSecurityGroup<Common request parameters>{"InstanceId": "xx","SecurityGroupIds": [
"xx"
]
}

Output Example{"Response": {"RequestId": "xx"}}5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java©2013-2022 Tencent Cloud. All rights reserved.

Page 143 of 190

TencentDB for MongoDB

Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InvalidParameter

Parameter error

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform thisoperation.

InvalidParameterValue.LockFailed

Instance lock failed.

InvalidParameterValue.NotFoundInstance

The instance was not found.

InvalidParameterValue.SecurityGroupId

Invalid security group ID

InvalidParameterValue.StatusAbnormal

The instance is in a status where operations are not allowed.

©2013-2022 Tencent Cloud. All rights reserved.

Page 144 of 190

TencentDB for MongoDB

ModifyDBInstanceNetworkAddress：

Last updated 2023-03-20 10:55:14

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to modify the network settings of a TencentDB instance, such as switching its network type fromclassic network to VPC or between VPCs.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter Name

RequiredType

ActionYes

String

VersionYes

StringRegionNo

String

InstanceId

Yes

StringDescription
Common Params. The value used for this
API: ModifyDBInstanceNetworkAddress.
Common Params. The value used for this
API: 2019-07-25.
Common Params. This parameter is not
required for this API.
Instance ID
Old IP retention period in minutes. The old IP

OldIpExpiredTime

Yes

Integer

will be released after the specified time, andboth the old and new IPs can be accessed
before the release. The value 0 indicatesthat the old IP will be reclaimed immediately.

NewUniqVpcId

YesString©2013-2022 Tencent Cloud. All rights reserved.

ID of the VPC to which the new IP belongs

Page 145 of 190

TencentDB for MongoDB

after the switch. When it is classic network,
this field will be empty.

NewUniqSubnetId

Yes

StringID of the subnet to which the new IP belongs
after the switch. When it is classic network,
this field will be empty.

NetworkAddresses.N

No

Array of
ModifyNetworkAddress

IP information to be modified

3. Output Parameters
Parameter
Name

Type

RequestId

StringDescription
The unique request ID, which is returned for each request. RequestId is required forlocating a problem.

4. Example
Example1 Modifying the network information of a TencentDB instance
Input Example
POST / HTTP/1.1
Host: mongodb.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyDBInstanceNetworkAddress<Common request parameters>{"InstanceId": "xx","InstanceId": "xx",{"OldIpAddress": "xx","NewIPAddress": "xx"}],
"OldIpExpiredTime": 1,"NewUniqVpcId": "xx","NewUniqSubnetId": "xx"}©2013-2022 Tencent Cloud. All rights reserved.

Page 146 of 190

TencentDB for MongoDB

Output Example{"Response": {"RequestId": "xx"}}5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InternalError.CheckAppIdFailed

appId verification failed.

InvalidParameter

Parameter error©2013-2022 Tencent Cloud. All rights reserved.

Page 147 of 190

TencentDB for MongoDB

InvalidParameter.InvalidVip

Invalid Vip information

InvalidParameterValue.StatusAbnormal

The instance is in a status where operations are notallowed.

InvalidParameterValue.VpcIdOrSubnetIdNotFoundThe VPC (subnet) was not found.

©2013-2022 Tencent Cloud. All rights reserved.

Page 148 of 190

TencentDB for MongoDB

Backup APIs
DescribeDBBackups：

Last updated 2023-03-20 10:55:18

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to query the list of instance backups. Currently, only backups created in the last seven days can bequeried.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter
Name

RequiredType

ActionYes

String

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

String

Instance ID in the format of cmgo-p8vnipr5. It is the same as theinstance ID displayed on the TencentDB Console page

BackupMethod

No

Integer

Limit

No

Integer©2013-2022 Tencent Cloud. All rights reserved.

Description
Common Params. The value used for this API:
DescribeDBBackups.

Backup mode. Valid values: 0 (logical backup), 1 (physicalbackup), 2 (both modes). Default value: 0 .
Number of entries per page. Maximum value: 100 . If thisPage 149 of 190

TencentDB for MongoDB

parameter is left empty, all entries will be returned.
OffsetNo

Integer

Pagination offset, starting from 0 . Default value: 0 .

3. Output Parameters
Parameter

Type

Description

BackupList

Array of
BackupInfo

Backup list

TotalCount

Integer

Total number of backups

RequestId

String

The unique request ID, which is returned for each request. RequestId isrequired for locating a problem.

Name

4. Example
Example1 Querying the backup file information of a TencentDB instance
Input Example
https://mongodb.tencentcloudapi.com/?Action=DescribeDBBackups&InstanceId=cmgo-f555zzzz&BackupMethod=1&<Common request parameters>

Output Example{"Response": {"RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7","BackupList": [],"TotalCount": 0}}

5. Developer Resources©2013-2022 Tencent Cloud. All rights reserved.

Page 150 of 190

TencentDB for MongoDB

SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InvalidParameter

Parameter error

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform thisoperation.

InvalidParameterValue.NotFoundInstance

The instance was not found.

©2013-2022 Tencent Cloud. All rights reserved.

Page 151 of 190

TencentDB for MongoDB

CreateBackupDBInstance：

Last updated 2023-03-20 10:55:18

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to create instance backups.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API:
CreateBackupDBInstance.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

String

Instance ID

BackupMethod

Yes

Integer

Valid values: 0 (logical backup), 1 (physical backup)

BackupRemark

NoStringBackup remarks

Name

3. Output Parameters©2013-2022 Tencent Cloud. All rights reserved.

Page 152 of 190

TencentDB for MongoDB

Parameter
Name

Type

Description

AsyncRequestId

String

The status of the queried backup process.

RequestId

String

The unique request ID, which is returned for each request. RequestId is required
for locating a problem.

4. Example
Example1 Creating instance backups
Input Example
https://mongodb.tencentcloudapi.com/?Action=CreateBackupDBInstance&InstanceId=cmgo-ayxpky6l&BackupRemark=remarkInfo&BackupMethod=0&<Common request parameters>

Output Example{"Response": {"AsyncRequestId": 4773,"RequestId": "e600a8d0-9014-11ea-84c1-01cccde830c6"}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS©2013-2022 Tencent Cloud. All rights reserved.

Page 153 of 190

TencentDB for MongoDB

Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InternalError.CheckAppIdFailed

appId verification failed.

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform thisoperation.

InvalidParameterValue.CheckAppIdFailed

appId verification failed.

InvalidParameterValue.IllegalInstanceStatus

Invalid instance status

InvalidParameterValue.NotFoundInstance

The instance was not found.

InvalidParameterValue.StatusAbnormal

The instance is in a status where operations are not allowed.

©2013-2022 Tencent Cloud. All rights reserved.

Page 154 of 190

TencentDB for MongoDB

DescribeBackupDownloadTask：

Last updated 2023-03-20 10:55:18

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to query backup download task information.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API:
DescribeBackupDownloadTask.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

StringBackupName

No

StringName

Instance ID in the format of "cmgo-p8vnipr5", which is the same as
the instance ID displayed in the TencentDB console
The name of a backup file with download tasks to be queried
The start time of the query period. Tasks whose start time and end

StartTimeNo

Stringtime fall within the query period will be queried. If it is left empty, thestart time can be any time earlier than the end time.

EndTimeNo

String

The end time of the query period. Tasks will be queried if their startand end times fall within the query period. If it is left empty, the end©2013-2022 Tencent Cloud. All rights reserved.

Page 155 of 190

TencentDB for MongoDB

time can be any time later than the start time.
Limit

No

Integer

OffsetNo

Integer

OrderByNo

StringOrderByType

No

String

No

Array
of

Status.N

The maximum number of results returned per page. Value range: 1100. Default value: 20 .
Offset for pagination. Default value: 0 .
The field used to sort the results. Valid values: createTime(default), finishTime .
Sort order. Valid values: asc , desc (default).
The status of the tasks to be queried. Valid values: 0 (waiting forexecution), 1 (downloading), 2 (downloaded), 3 (download
failed), 4 (waiting for retry). If it is left empty, tasks in any status will

Integerbe returned.

3. Output Parameters
Parameter
Name

Type

Description

TotalCount

Integer

Total number of results

Tasks

Array of
BackupDownloadTask

The list of download tasks

RequestId

String

The unique request ID, which is returned for each request. RequestId
is required for locating a problem.

4. Example
Example1 Querying backup download task information
Input Example
https://mongodb.tencentcloudapi.com/?Action=DescribeBackupDownloadTask&InstanceId=cmgo-dygv1rnp&Status.0=2&<Common request parameters>

Output Example©2013-2022 Tencent Cloud. All rights reserved.

Page 156 of 190

TencentDB for MongoDB{"Response": {"RequestId": "c41c0c46-7d5a-49b9-832a-557880c1e9ef","Tasks": [{"BackupName": "cmgo-dygv1rnp_2021-03-26 10:44","BackupSize": 844,
"CreateTime": "2021-03-26 10:47:37","Percent": 100,
"ReplicaSetId": "cmgo-dygv1rnp_0","Status": 2,"TimeSpend": 0,"Url": "https://mognodb-backup-test-tar-1251937656.cos.ap-guangzhou.myqcloud.com/
cmgo-dygv1rnp_2021-03-26%2010%3A44%2Fcmgo-dygv1rnp_0.tar?q-sign-algorithm=sha1&qak=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&q-sign-time=1616726859%3B1616813259&q-key-time=
1616726859%3B1616813259&q-header-list=host&q-url-param-list=&q-signature=xxxxxxxx
xxxxxxxxxxxxxxxxxxxxxx"}],"TotalCount": 1}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0©2013-2022 Tencent Cloud. All rights reserved.

Page 157 of 190

TencentDB for MongoDB

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

AuthFailure

CAM signature/authentication error

InternalError

Internal error

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform thisoperation.

InvalidParameterValue.BackupFileNotFoundThe backup file was not found.

InvalidParameterValue.NotFoundInstance

The instance was not found.

©2013-2022 Tencent Cloud. All rights reserved.

Page 158 of 190

TencentDB for MongoDB

CreateBackupDownloadTask：

Last updated 2023-03-20 10:55:18

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to create a backup download task.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter
Name

RequiredType

ActionYes

String

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

String

Instance ID in the format of "cmgo-p8vnipr5", which is thesame as the instance ID displayed in the TencentDB

InstanceId

Yes

Description
Common Params. The value used for this API:
CreateBackupDownloadTask.

console.
BackupName

Yes

String

The name of the backup file to be downloaded, which can beobtained by the DescribeDBBackups API.

BackupSets.N

Yes

Array ofReplicaSetInfo

Specify the node name of a replica set instance or the shard
name list of a sharded cluster instance. Only backups of thespecified node or shards will be downloaded.
Suppose you have a replica set instance (ID: cmgo-©2013-2022 Tencent Cloud. All rights reserved.

Page 159 of 190

TencentDB for MongoDB

p8vnipr5), you can use the sample code
BackupSets.0=cmgo-p8vnipr5_0 to download thefull backup. For a replica set instance, the parameter value
must be in the format of "instance ID_0".
Suppose you have a sharded cluster instance (ID: cmgop8vnipr5), you can use the sample code
BackupSets.0=cmgop8vnipr5_0&BackupSets.1=cmgo-p8vnipr5_1 todownload the backup data of shard 0 and shard 1. To
download the full backup, please specify all shard names.

3. Output Parameters
Parameter
Name

Type

Description

Tasks

Array of
BackupDownloadTaskStatus

Download task status

RequestId

String

The unique request ID, which is returned for each request.
RequestId is required for locating a problem.

4. Example
Example1 Creating a backup download task
Input Example
https://mongodb.tencentcloudapi.com/?Action=CreateBackupDownloadTask&InstanceId=cmgo-dygv1rnp&BackupName=cmgo-dygv1rnp_2021-03-26 10:44&BackupSets.0.ReplicaSetId=cmgo-dygv1rnp_0&<Common request parameters>

Output Example{"Response": {"RequestId": "6ed8d110-67be-4650-83b0-5df5a897e9e6","Tasks": [{©2013-2022 Tencent Cloud. All rights reserved.

Page 160 of 190

TencentDB for MongoDB"ReplicaSetId": "cmgo-dygv1rnp_0","Status": 2}]}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InternalError.CheckAppIdFailed

appId verification failed.

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform thisoperation.

InvalidParameterValue.BackupFileNotFoundThe backup file was not found.

©2013-2022 Tencent Cloud. All rights reserved.

Page 161 of 190

TencentDB for MongoDB

InvalidParameterValue.NotFoundInstance©2013-2022 Tencent Cloud. All rights reserved.

The instance was not found.

Page 162 of 190

TencentDB for MongoDB

Account APIs
ResetDBInstancePassword：

Last updated 2023-03-20 10:55:19

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to modify instance password.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter
Name

RequiredType

ActionYes

String

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

String

Instance ID

UserName

Yes

String

Instance account name

Password

Yes

String

New password, which must contain at least eight characters

Description
Common Params. The value used for this API:
ResetDBInstancePassword.

3. Output Parameters©2013-2022 Tencent Cloud. All rights reserved.

Page 163 of 190

TencentDB for MongoDB

Parameter

Type

Description

AsyncRequestId

StringAsync request ID, which is used to query the running status of the process.

RequestId

StringName

The unique request ID, which is returned for each request. RequestId is required
for locating a problem.

4. Example
Example1 Modifying the instance password
Input Example
https://mongodb.tencentcloudapi.com/?Action=ResetDBInstancePassword&InstanceId=cmgo-7pjedvz7&UserName=rwuser&Password=111111&<Common request parameters>

Output Example{"Response": {"AsyncRequestId": "4769","RequestId": "e600a8d0-9014-11ea-84c1-01cccde830c6"}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go©2013-2022 Tencent Cloud. All rights reserved.

Page 164 of 190

TencentDB for MongoDB

Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InvalidParameter

Parameter error

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform thisoperation.

InvalidParameterValue.IllegalInstanceStatus

Invalid instance status

InvalidParameterValue.LockFailed

Instance lock failed.

InvalidParameterValue.NotFoundInstance

The instance was not found.

InvalidParameterValue.PasswordRuleFailed

The password is non-compliant.

InvalidParameterValue.StatusAbnormal

The instance is in a status where operations are not allowed.

InvalidParameterValue.UserNotFoundThe user account does not exist.

©2013-2022 Tencent Cloud. All rights reserved.

Page 165 of 190

TencentDB for MongoDB

Task APIs
DescribeAsyncRequestInfo：

Last updated 2023-03-20 10:55:12

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to query async task status.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter
Name

RequiredType

ActionYes

String

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

AsyncRequestId

YesStringAsync task ID, which is returned by APIs related to async tasks,
such as CreateBackupDBInstance .

Description
Common Params. The value used for this API:
DescribeAsyncRequestInfo.

3. Output Parameters
Parameter

Type

Description©2013-2022 Tencent Cloud. All rights reserved.

Page 166 of 190

TencentDB for MongoDB

Name
Status. Valid values: initial (initializing), running , paused (paused due toStatusStringfailure), undoed (rolled back due to failure), failed (ended due to failure),
success

RequestId

String

The unique request ID, which is returned for each request. RequestId is required forlocating a problem.

4. Example
Example1 Querying async task status
Input Example
https://mongodb.tencentcloudapi.com/?Action=DescribeAsyncRequestInfo&AsyncRequestId=4762&<Common request parameters>

Output Example{"Response": {"RequestId": "e600a8d0-9014-11ea-84c1-01cccde830c6","Status": "success"}}5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS©2013-2022 Tencent Cloud. All rights reserved.

Page 167 of 190

TencentDB for MongoDB

Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform this operation.

InvalidParameterValue.StatusAbnormal

The instance is in a status where operations are not allowed.

©2013-2022 Tencent Cloud. All rights reserved.

Page 168 of 190

TencentDB for MongoDB

Other APIs
FlushInstanceRouterConfig：

Last updated 2023-03-20 10:55:13

1. API Description
Domain name for API request: mongodb.tencentcloudapi.com.
This API is used to run the FlushRouterConfig command on all mongos instances.
A maximum of 20 requests can be initiated per second for this API.
We recommend you to use API Explorer
Try itAPI 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.

2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For thecomplete common parameter list, see Common Request Parameters.
Parameter
Name

RequiredType

Description

ActionYes

StringCommon Params. The value used for this API:
FlushInstanceRouterConfig.

VersionYes

StringCommon Params. The value used for this API: 2019-07-25.

RegionNo

StringCommon Params. This parameter is not required for this API.

InstanceId

Yes

String

Instance ID

3. Output Parameters
Parameter
Name

Type

Description©2013-2022 Tencent Cloud. All rights reserved.

Page 169 of 190

TencentDB for MongoDB

RequestId

String

The unique request ID, which is returned for each request. RequestId is required forlocating a problem.

4. Example
Example1 Running "FlushRouterConfig" on all mongos nodes
Input Example
https://mongodb.tencentcloudapi.com/?Action=FlushInstanceRouterConfig&InstanceId=cmgo-a3bm93hf&<Common request parameters>

Output Example{"Response": {"RequestId": "0ad9f471-fb8f-402a-aa78-b1640c6670c4"}}

5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call
APIs.
Tencent Cloud SDK 3.0 for Python
Tencent Cloud SDK 3.0 for Java
Tencent Cloud SDK 3.0 for PHP
Tencent Cloud SDK 3.0 for Go
Tencent Cloud SDK 3.0 for NodeJS
Tencent Cloud SDK 3.0 for .NET
Tencent Cloud SDK 3.0 for C++

Command Line Interface
Tencent Cloud CLI 3.0©2013-2022 Tencent Cloud. All rights reserved.

Page 170 of 190

TencentDB for MongoDB

6. Error CodeThe following only lists the error codes related to the API business logic. For other error codes, see Common Error
Codes.
Error CodeDescription

InternalError

Internal error

InternalError.CheckAppIdFailed

appId verification failed.

InvalidParameter.PermissionDenied

The current subaccount has no permission to perform this operation.

InvalidParameterValue

Invalid parameter value©2013-2022 Tencent Cloud. All rights reserved.

Page 171 of 190

TencentDB for MongoDB

Data Types：

Last updated 2023-03-08 12:00:32

BackupDownloadTask
Backup download task information
Used by actions: DescribeBackupDownloadTask.
Name

Type

Description

CreateTime

StringTask creation time

BackupName

StringBackup name

ReplicaSetId

StringShard name

BackupSize

Integer

Backup size in bytes

StatusInteger

Percent

Integer

Task progress in percentage

TimeSpend

Integer

Task duration in seconds

Url

StringBackup download address

BackupMethod

Integer

Task status. Valid values: 0 (waiting for execution), 1 (downloading), 2(downloaded), 3 (download failed), 4 (waiting for retry)

Backup type of the backup file. Valid values: 0 (logical backup), 1 (physicalbackup)Backup description you set when starting a backup task

BackupDesc

StringNote: This field may return null , indicating that no valid values can beobtained.

BackupDownloadTaskStatus
The result of the created backup download task
Used by actions: CreateBackupDownloadTask.
Name

Type

Description©2013-2022 Tencent Cloud. All rights reserved.

Page 172 of 190

TencentDB for MongoDB

ReplicaSetId

StringStatusInteger

Shard nameTask status. Valid values: 0 (waiting for execution), 1 (downloading), 2(downloaded), 3 (download failed), 4 (waiting for retry)

BackupInfo
Backup information
Used by actions: DescribeDBBackups.
Name

Type

Description

InstanceId

String

Instance ID

BackupType

Integer

Backup mode. 0: automatic backup; 1: manual backup

BackupName

StringBackup name

BackupDesc

StringBackupSize

IntegerStartTime

StringBackup start time
Note: This field may return null, indicating that no valid values can be obtained.

EndTimeStringBackup end time
Note: This field may return null, indicating that no valid values can be obtained.

StatusInteger

Backup status. 1: backing up; 2: backed up successful

BackupMethod

Integer

Backup method. 0: logical backup; 1: physical backup

Backup remarks
Note: This field may return null, indicating that no valid values can be obtained.
Backup file size in KB
Note: This field may return null, indicating that no valid values can be obtained.

ClientConnection
Client connection information, including client IP and number of connections
Used by actions: DescribeClientConnections.
Name

Type

Description

IP

StringClient IP of a connection©2013-2022 Tencent Cloud. All rights reserved.

Page 173 of 190

TencentDB for MongoDB

Count

IntegerNumber of connections corresponding to a client IPInternalService

BooleanWhether it is the Tencent Cloud IP for automated testing

DBInstanceInfo
Instance information
Used by actions: DescribeDBInstances.
Name

Type

Description

InstanceId

String

Instance ID

RegionStringRegion information

DBInstancePrice
Instance price
Used by actions: InquirePriceCreateDBInstances, InquirePriceModifyDBInstanceSpec,
InquirePriceRenewDBInstances.
Name

UnitPrice

Type

Float

Required

Description

Yes

Unit price.
Note: this field may return null, indicating that no valid values can beobtained.

OriginalPrice

Float

Yes

Original price.

DiscountPrice

Float

Yes

Discounted price.

InstanceChargePrepaid
Description on the billing mode of an instance
Used by actions: InquirePriceRenewDBInstances, RenewDBInstances.
Name

Type

Required

Description©2013-2022 Tencent Cloud. All rights reserved.

Page 174 of 190

TencentDB for MongoDB

PeriodInteger

No

Purchased usage period (in month). Valid values: 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 24, 36 . Default value: 1 .
(This parameter is required in InquirePriceRenewDBInstances
and RenewDBInstances APIs.)
Auto-renewal flag. Valid values:
NOTIFY_AND_AUTO_RENEW : notify expiration and renew
automatically
NOTIFY_AND_MANUAL_RENEW : notify expiration but not renew
automatically
DISABLE_NOTIFY_AND_MANUAL_RENEW : neither notify expiration

RenewFlag

StringNo

nor renew automaticallyDefault value: NOTIFY_AND_MANUAL_RENEW . If this parameter is
specified as NOTIFY_AND_AUTO_RENEW , the instance will be
automatically renewed on a monthly basis when the account balance issufficient.
(This parameter is required in InquirePriceRenewDBInstances
and RenewDBInstances APIs.)

InstanceDetail
Instance details
Used by actions: DescribeDBInstances.
Name

Type

Description

InstanceId

String

Instance ID

InstanceName

String

Instance name

PayModeInteger

Billing type. Valid value: 0 (pay-as-you-go)

ProjectId

Integer

Project ID

ClusterType

Integer

RegionStringRegion information

Zone

String

AZ information

NetType

Integer

Network type. Valid values: 0 (basic network), 1 (VPC)©2013-2022 Tencent Cloud. All rights reserved.

Cluster type. Valid values: 0 (replica set instance), 1(sharded instance).

Page 175 of 190

TencentDB for MongoDB

VpcId

String

VPC ID

SubnetId

StringSubnet ID of VPC

StatusInteger

Vip

String

Instance IP

Vport

Integer

Port number

CreateTime

Timestamp

Instance creation time

DeadLine

Timestamp

Instance expiration time

MongoVersion

String

Instance version information

MemoryInteger

Instance memory size in MB

VolumeInteger

Instance disk size in MB

CpuNumIntegerNumber of CPU cores of an instance

MachineType

String

Instance machine type

SecondaryNum

IntegerNumber of secondary nodes of an instance

ReplicationSetNum

IntegerNumber of instance shards

AutoRenewFlag

Integer

UsedVolume

Integer

Used capacity in MB

MaintenanceStart

StringStart time of the maintenance time

MaintenanceEnd

String

End time of the maintenance time

ReplicaSets

Array ofShardInfo

Instance status. Valid values: 0 (to be initialized), 1 (inprocess), 2 (running), -2 (expired).

Instance auto-renewal flag. Valid values: 0 (manual renewal),
1 (auto-renewal), 2 (no renewal upon expiration)

Shard information

ReadonlyInstances

Array of
DBInstanceInfo

Information of read-only instancesStandbyInstances

Array of
DBInstanceInfo

Information of disaster recovery instances

CloneInstances

Array of
DBInstanceInfo©2013-2022 Tencent Cloud. All rights reserved.

Information of temp instances

Page 176 of 190

TencentDB for MongoDB

RelatedInstance

DBInstanceInfo

Information of associated instances. For a regular instance, thisfield represents the information of its temp instance; for a temp
instance, this field represents the information of its regularinstance; and for a read-only instance or a disaster recovery
instance, this field represents the information of its primary
instance.

Tags

Array ofTagInfo

Instance tag information set

InstanceVer

Integer

Instance version

ClusterVer

Integer

Instance version

ProtocolInteger

InstanceType

Integer

Instance type. Valid values: 1 (promoted instance), 2 (temp
instance), 3 (read-only instance), 4 (disaster recovery instance)

InstanceStatusDesc

String

Instance status description

RealInstanceId

StringProtocol information. Valid values: 1 (mongodb), 2(dynamodb).

Physical instance ID. For an instance that has been rolled backand replaced, its InstanceId and RealInstanceId are different.
The physical instance ID is needed in such scenarios as getting
monitoring data from Barad
Number of mongos nodes

MongosNodeNum

MongosMemory

Integer

Integer

Note: This field may return null, indicating that no valid values canbe obtained.
mongos node memory
Note: This field may return null, indicating that no valid values canbe obtained.

MongosCpuNum

IntegerNumber of mongos nodes
Note: This field may return null, indicating that no valid values canbe obtained.
Number of ConfigServer nodes

ConfigServerNodeNum

Integer

Note: This field may return null, indicating that no valid values canbe obtained.
Memory of ConfigServer node

ConfigServerMemory

Integer

Note: This field may return null, indicating that no valid values canbe obtained.

ConfigServerVolume

Integer

Disk size of ConfigServer node©2013-2022 Tencent Cloud. All rights reserved.

Page 177 of 190

TencentDB for MongoDB

Note: This field may return null, indicating that no valid values canbe obtained.

ConfigServerCpuNum

Integer

CPU number of ConfigServer nodeNote: This field may return null, indicating that no valid values canbe obtained.

ReadonlyNodeNum

IntegerNumber of read-only nodes
Note: This field may return null, indicating that no valid values canbe obtained.

InstanceEnumParam
The collection of modifiable enum parameters of an instance.
Used by actions: DescribeInstanceParams.
Name

Type

Description

CurrentValue

StringCurrent value

DefaultValue

StringDefault value

Array
EnumValueofStringAcceptable values

NeedRestart

StringParamName

StringParameter name

Tips

Array
of

Parameter description

Whether to restart the instance for the parameter to take effect. Valid values: 1(yes), 0 (no, which means the parameter setting takes effect immediately)

StringValueType

StringStatusInteger

Data type of the parameter
Whether CurrentValue is the parameter value actually in use. Valid values:
1 (yes), 0 (no)InstanceIntegerParam©2013-2022 Tencent Cloud. All rights reserved.

Page 178 of 190

TencentDB for MongoDB

The collection of modifiable integer parameters of an instance.
Used by actions: DescribeInstanceParams.
Name

Type

Description

CurrentValue

StringCurrent value

DefaultValue

StringDefault value

Max

StringMaximum value

Min

StringMinimum value

NeedRestart

StringParamName

StringWhether to restart the instance for the parameter to take effect. Valid values: 1(yes), 0 (no, which means the parameter setting takes effect immediately)Parameter name

Array
Tips

of
StringParameter description

ValueType

StringData type of the parameter

StatusInteger

Unit

StringWhether CurrentValue is the parameter value actually in use. Valid values:
1 (yes), 0 (no)Redundant field which can be ignored

InstanceMultiParam
The collection of modifiable string parameters of an instance which are used to represent time ranges.
Used by actions: DescribeInstanceParams.
Name

Type

Description

CurrentValue

StringCurrent value

DefaultValue

StringDefault value

Array
EnumValueofStringAcceptable values©2013-2022 Tencent Cloud. All rights reserved.

Page 179 of 190

TencentDB for MongoDB

NeedRestart

StringWhether to restart the instance for the parameter to take effect. Valid values: 1(yes), 0 (no, which means the parameter setting takes effect immediately)ParamName

StringStatusInteger

Tips

Array
of

Parameter name
Whether CurrentValue is the parameter value actually in use. Valid values:
1 (yes), 0 (no)Parameter description

StringValueType

StringData type of the current value. Default value: multiInstanceTextParam
The collection of modifiable text parameters of an instance.
Used by actions: DescribeInstanceParams.
Name

Type

Description

CurrentValue

StringCurrent value

DefaultValue

StringDefault value

NeedRestart

StringWhether to restart the instance for the parameter to take effectParamName

StringParameter name

TextValue

StringValue of a text parameter

Tips

Array of
StringValueType

StringStatusStringParameter description
Value type
Whether CurrentValue is the parameter value actually in use. Valid values:
1 (yes), 0 (no)ModifyNetworkAddress
Database IP to be modified©2013-2022 Tencent Cloud. All rights reserved.

Page 180 of 190

TencentDB for MongoDB

Used by actions: ModifyDBInstanceNetworkAddress.
Name

Type

Required

Description

NewIPAddress

StringYes

New IP

OldIpAddress

StringYes

Old IP

ReplicaSetInfo
Shard information
Used by actions: CreateBackupDownloadTask.
Name

Type

Required

Description

ReplicaSetId

StringYes

Replica set ID

SecurityGroup
Security group information
Used by actions: DescribeSecurityGroup.
Name

Type

Description

ProjectId

Integer

Project ID

CreateTime

StringCreation time

Inbound

Array of SecurityGroupBound

Inbound rule

OutboundArray of SecurityGroupBound

Outbound rule

SecurityGroupId

StringSecurity group ID

SecurityGroupName

StringSecurity group nameSecurityGroupRemark

StringSecurity group remarks

SecurityGroupBound©2013-2022 Tencent Cloud. All rights reserved.

Page 181 of 190

TencentDB for MongoDB

Security group rule
Used by actions: DescribeSecurityGroup.
Name

Type

Description

ActionStringExecution rule. Valid values: ACCEPT , DROP

CidrIpStringIP range

PortRange

String

Port range

IpProtocol

StringTransport layer protocol. Valid values: tcp , udp , ALL

Id

String

All the addresses that the security group ID represents

AddressModule

String

All the addresses that the address group ID represents

ServiceModule

String

All the protocols and ports that the service group ID represents

Desc

StringDescription

ShardInfo
Details of an instance shard
Used by actions: DescribeDBInstances.
Name

Type

Description

UsedVolume

Float

Used shard capacity

ReplicaSetId

StringShard ID

ReplicaSetName

StringShard nameMemoryInteger

Shard memory size in MB

VolumeInteger

Shard disk size in MB

OplogSize

Integer

Shard oplog size in MB

SecondaryNum

IntegerNumber of secondary nodes of a shard

RealReplicaSetId

StringShard physical ID©2013-2022 Tencent Cloud. All rights reserved.

Page 182 of 190

TencentDB for MongoDB

SlowLogPattern
Slow log statistics of MongoDB database
Used by actions: DescribeSlowLogPatterns.
Name

Type

Description

Pattern

StringSlow log pattern

MaxTimeIntegerMaximum execution time

AverageTime

Integer

Average execution time

Total

IntegerNumber of slow logs in this pattern

SpecItemSpecifications of purchasable MongoDB instances
Used by actions: DescribeSpecInfo.
Name

Type

Description

SpecCode

StringSpecification information identifier

StatusInteger

Cpu

Integer

Computing resource specification in terms of CPU core

MemoryInteger

Memory size in MB

DefaultStorage

Integer

Default disk size in MB

MaxStorage

IntegerMaximum disk size in MB

MinStorage

Integer

Minimum disk size in MB

Qps

IntegerMaximum QPS

Conns

IntegerMaximum number of connections

MongoVersionCode

StringMongoDB version information of an instance

MongoVersionValue

Integer

MongoDB version number of an instance©2013-2022 Tencent Cloud. All rights reserved.

Specification purchasable flag. Valid values: 0 (not purchasable), 1(purchasable)

Page 183 of 190

TencentDB for MongoDB

VersionStringMongoDB version number of an instance (short)EngineName

StringStorage engine

ClusterType

Integer

Cluster type. Valid values: 1 (sharding cluster), 0 (replica set cluster)

MinNodeNum

Integer

Minimum number of secondary nodes in a replica set

MaxNodeNum

IntegerMaximum number of secondary nodes in a replica set

MinReplicateSetNum

Integer

Minimum number of shards

MaxReplicateSetNum

IntegerMaximum number of shards

MinReplicateSetNodeNum

Integer

Minimum number of secondary nodes in a shard

MaxReplicateSetNodeNum

IntegerMaximum number of secondary nodes in a shard

MachineType

StringServer type. Valid values: 0 (HIO), 4 (HIO10G)

SpecificationInfo
Instance specification information
Used by actions: DescribeSpecInfo.
Name

Type

Description

RegionStringRegion information

Zone

String

AZ information

SpecItems

SupportMultiAZ

Array ofSpecItemInteger

Purchasable specification information
Whether cross-AZ deployment is supported. Valid values: 1 (yes),
0 (no).

TagInfo
Instance tag information
Used by actions: CreateDBInstance, CreateDBInstanceHour, DescribeDBInstances.

©2013-2022 Tencent Cloud. All rights reserved.

Page 184 of 190

TencentDB for MongoDB

Name

Type

Required

Description

TagKeyStringYes

Tag key

TagValue

StringYes

Tag value©2013-2022 Tencent Cloud. All rights reserved.

Page 185 of 190

TencentDB for MongoDB

Error Codes：

Last updated 2023-03-08 12:00:32

Feature Description
If there is an Error field in the response, it means that the API call failed. For example:{"Response": {"Error": {"Code": "AuthFailure.SignatureFailure","Message": "The provided credentials could not be validated. Please check your si
gnature is correct."},"RequestId": "ed93f3cb-f35e-473f-b9f3-0d451b8b79c6"}}
Code in Error indicates the error code, and Message indicates the specific information of the error.

Error Code List
Common Error Codes
Error CodeDescription

ActionOffline

This API has been deprecated.

AuthFailure.InvalidAuthorization

Authorization in the request header is invalid.

AuthFailure.InvalidSecretId

Invalid key (not a TencentCloud API key type).

AuthFailure.MFAFailure

MFA failed.
Key does not exist. Check if the key has been

AuthFailure.SecretIdNotFound

deleted or disabled in the console, and if not, checkif the key is correctly entered. Note that whitespaces
should not exist before or after the key.

AuthFailure.SignatureExpire©2013-2022 Tencent Cloud. All rights reserved.

Signature expired. Timestamp and server timecannot differ by more than five minutes. Please

Page 186 of 190

TencentDB for MongoDB

ensure your current local time matches the standard
time.
Invalid signature. Signature calculation error. Please
AuthFailure.SignatureFailure

ensure you’ve followed the signature calculation
process described in the Signature API
documentation.

AuthFailure.TokenFailure
AuthFailure.UnauthorizedOperation

Token error.
The request is not authorized. For more information,
see the CAM documentation.
DryRun Operation. It means that the request would

DryRunOperation

have succeeded, but the DryRun parameter wasused.

FailedOperation

Operation failed.

InternalError

Internal error.

InvalidAction

The API does not exist.

InvalidParameter

Incorrect parameter.

InvalidParameterValue

Invalid parameter value.

InvalidRequest

The multipart format of the request body is incorrect.

IpInBlacklist

Your IP is in uin IP blacklist.

IpNotInWhitelistYour IP is not in uin IP whitelist.

LimitExceeded

Quota limit exceeded.

MissingParameter

A parameter is missing.

NoSuchProduct

The product does not exist.

NoSuchVersion

The API version does not exist.

RequestLimitExceeded

The number of requests exceeds the frequency limit.

RequestLimitExceeded.GlobalRegionUinLimitExceeded

Uin exceeds the frequency limit.

RequestLimitExceeded.IPLimitExceeded

The number of ip requests exceeds the frequency
limit.

RequestLimitExceeded.UinLimitExceeded

The number of uin requests exceeds the frequency©2013-2022 Tencent Cloud. All rights reserved.

Page 187 of 190

TencentDB for MongoDB

limit.
RequestSizeLimitExceeded

The request size exceeds the upper limit.

ResourceInUse

Resource is in use.

ResourceInsufficientInsufficient resource.

ResourceNotFoundThe resource does not exist.

ResourceUnavailable

Resource is unavailable.

ResponseSizeLimitExceeded

The response size exceeds the upper limit.

ServiceUnavailable

Service is unavailable now.

UnauthorizedOperation

Unauthorized operation.

UnknownParameter

Unknown parameter.

UnsupportedOperation

Unsupported operation.

UnsupportedProtocol
UnsupportedRegion

HTTP(S) request protocol error; only GET and
POST requests are supported.
API does not support the requested region.

Service Error Codes
Error CodeDescription

AuthFailure

CAM signature/authentication error

InternalError.CheckAppIdFailed

appId verification failed.

InternalError.FindInstanceFailed

Failed to query the instance.

InvalidParameter.CurrentInstanceNotSupportModifyParams

The instance does not support parametersetting.

InvalidParameter.InvalidVip

Invalid Vip information

InvalidParameter.PermissionDenied

The current subaccount has no permission to
perform this operation.

InvalidParameter.ZoneClosed

Instances are not purchasable in this AZ.

InvalidParameterValue.BackupFileNotFoundThe backup file was not found.

©2013-2022 Tencent Cloud. All rights reserved.

Page 188 of 190

TencentDB for MongoDB

InvalidParameterValue.CheckAppIdFailed

appId verification failed.

InvalidParameterValue.ClusterTypeError

Invalid instance type.

InvalidParameterValue.IllegalInstanceName

Invalid instance name

InvalidParameterValue.IllegalInstanceStatus

Invalid instance status
The instance cannot be deactivated in theInvalidParameterValue.IllegalStatusToOffline

current status. Only isolated instances can bedeactivated.

InvalidParameterValue.InstanceHasBeenDeleted

The instance has been deleted.

InvalidParameterValue.InstanceHasBeenIsolated

The instance has been isolated.
Billing error. Corresponding

InvalidParameterValue.InvalidTradeOperation

purchase/renewal/configuration change
operations are not allowed for the current
instance.

InvalidParameterValue.LockFailed

Instance lock failed.

InvalidParameterValue.MachineTypeError

Incorrect model.

InvalidParameterValue.ModifyModeError

Memory and disk must be upgraded ordegraded simultaneously.

InvalidParameterValue.MongoVersionError

The instance version is incorrect.

InvalidParameterValue.MongoVersionNotSupportQueryClient

The instance version does not support
querying the instance client information.

InvalidParameterValue.NotFoundInstance

The instance was not found.
The OplogSize parameter is set

InvalidParameterValue.OplogSizeOutOfRange

incorrectly and should be between 10% and
90% of the disk capacity.

InvalidParameterValue.PasswordRuleFailed
InvalidParameterValue.PostPaidInstanceBeyondLimit

The password is non-compliant.
The number of postpaid instances in a single
region exceeds the limit.

InvalidParameterValue.PrePaidInstanceUnableToIsolate

Prepaid instances cannot be terminated.

InvalidParameterValue.ProjectNotFoundThe project does not exist.

InvalidParameterValue.ProxyNotSupportQueryClient

The proxy version does not support querying©2013-2022 Tencent Cloud. All rights reserved.

Page 189 of 190

TencentDB for MongoDB

the instance client information. Please submit aticket for upgrade.
InvalidParameterValue.QueryTimeOutOfRange

InvalidParameterValue.QueryTimeRangeBeyondLimit

Only slow logs generated in the past sevendays can be queried.
Only slow logs generated in the past sevendays can be queried.

InvalidParameterValue.RegionError

Invalid region

InvalidParameterValue.RegionNotSupportQueryClient

The region does not support querying the
instance client information.

InvalidParameterValue.ReplicaSetNumError

Incorrect number of replica sets (shards).

InvalidParameterValue.SecondaryNumError

Incorrect number of secondary nodes.

InvalidParameterValue.SecurityGroupId

Invalid security group ID

InvalidParameterValue.SetDiskLessThanUsed

InvalidParameterValue.SlowMSBelowLimit
InvalidParameterValue.SpecNotOnSale
InvalidParameterValue.StartTimeNotBeforeThanEndTime

InvalidParameterValue.StatusAbnormal

The disk size to be set cannot be less than 1.2
times the used disk capacity.
The value of the slowMS parameter should
be at least 100 ms.
Incorrect purchasable specification.
The start time should be earlier than the end
time.
The instance is in a status where operations
are not allowed.

InvalidParameterValue.TagNotFoundThe specified tag was not found.

InvalidParameterValue.UserNotFoundThe user account does not exist.

InvalidParameterValue.VpcIdOrSubnetIdNotFoundThe VPC (subnet) was not found.

InvalidParameterValue.ZoneClosed

Instances are not purchasable in this AZ.

InvalidParameterValue.ZoneError

Invalid availability zone

UnsupportedOperation.VersionNotSupport©2013-2022 Tencent Cloud. All rights reserved.

The current version does not support theoperation.

Page 190 of 190