tencent cloud



Last updated: 2023-08-09 14:43:28

1. API Description

Domain name for API request: tdmq.tencentcloudapi.com.

This API is used to create a TDMQ namespace.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateEnvironment.
Version Yes String Common Params. The value used for this API: 2020-02-17.
Region No String Common Params. This parameter is not required for this API.
EnvironmentId Yes String Environment (namespace) name, which can contain up to 16 letters, digits, hyphens, and underscores.
MsgTTL Yes Integer Retention period for unconsumed messages in seconds. Value range: 60s to 1,296,000s (or 15 days).
Remark No String Remarks (up to 128 characters).
ClusterId No String Pulsar cluster ID
RetentionPolicy No RetentionPolicy Message retention policy
AutoSubscriptionCreation No Boolean Whether to enable "Auto-Create Subscription"

3. Output Parameters

Parameter Name Type Description
EnvironmentId String Environment (namespace) name.
MsgTTL Integer TTL for unconsumed messages in seconds.
Remark String Remarks (up to 128 characters).
Note: this field may return null, indicating that no valid values can be obtained.
NamespaceId String Namespace ID
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating a namespace

This example shows you how to create a namespace. You can enable "Auto-Create Subscription" as needed when creating the namespace.

Input Example

Host: tdmq.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateEnvironment
<Common request parameters>

    "EnvironmentId": "test1",
    "MsgTTL": "100",
    "AutoSubscriptionCreation": true,
    "ClusterId": "pulsar-xxxxxxxx"

Output Example

    "Response": {
        "EnvironmentId": "test1",
        "NamespaceId": "namespace-8893gp3428",
        "MsgTTL": 100,
        "Remark": "",
        "RequestId": "0843ea4f-d6ba-463b-952c-75708a7e8901"

5. Developer Resources


TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

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

Error Code Description
AuthFailure.UnauthorizedOperation CAM authentication failed.
FailedOperation Operation failed.
FailedOperation.CreateEnvironment Failed to create the environment.
FailedOperation.CreateNamespace Failed to create the namespace.
InternalError.SystemError System error.
InvalidParameterValue.InvalidParams The parameter value is out of the value range.
InvalidParameterValue.TTL The message TTL value is invalid.
LimitExceeded.Environments The number of environments under the instance exceeds the limit.
LimitExceeded.Namespaces The number of namespaces under the instance exceeds the limit.
LimitExceeded.RetentionSize The remaining quota has been exceeded. Please enter a valid value.
LimitExceeded.RetentionTime The message retention period limit has been exceeded. Please enter a valid value.
MissingParameter.NeedMoreParams A required parameter is missing.
OperationDenied.DefaultEnvironment Operations on the default environment are not allowed.
ResourceInUse The resource is in use.
ResourceInUse.Namespace A namespace with the same name already exists.
ResourceNotFound.Cluster The cluster does not exist.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support