tencent cloud

UpdateScenario
最后更新时间:2025-10-30 21:53:27
UpdateScenario
最后更新时间: 2025-10-30 21:53:27

1. API Description

Domain name for API request: pts.intl.tencentcloudapi.com.

This API is used to update a scenario.

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: UpdateScenario.
Version Yes String Common Params. The value used for this API: 2021-07-28.
Region No String Common Params. This parameter is not required for this API.
ScenarioId Yes String Scenario ID.
Name No String Scenario name. When calling this API, please include the fields in the Scenario that do not need to be modified as part of the API parameters, otherwise the scenario may become unusable.
Description No String Scenario description.
Type No String Mode type of scenario. Valid values: 'pts-http' represents the simple mode, 'pts-js' represents the script mode, 'pts-jmeter' represents the JMeter mode.
Load No Load Load configuration.
EncodedScripts No String Deprecated.
Configs.N No Array of String Deprecated.
Datasets.N No Array of TestData Test datasets.
Extensions.N No Array of String Deprecated.
SLAId No String SLA rule ID.
CronId No String Cron job ID.
Status No Integer Scenario status (Note: This parameter is no longer required).
ProjectId No String Project ID.
TestScripts.N No Array of ScriptInfo Test scripts.
Protocols.N No Array of ProtocolInfo Protocol.
RequestFiles.N No Array of FileInfo Request files.
SLAPolicy No SLAPolicy SLA policy.
Plugins.N No Array of FileInfo Extension plugins.
DomainNameConfig No DomainNameConfig Domain name resolution configuration.
NotificationHooks.N No Array of Notification Notification web hook configuration.
Owner No String Creator name.
EnvId No String Environment ID.

3. Output Parameters

Parameter Name Type Description
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Update scenario

Update scenario

Input Example

POST / HTTP/1.1
Host: pts.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: UpdateScenario
<Common request parameters>

{
    "ScenarioId": "scenario-abc",
    "Name": "pts-js(2023-05-12 16:12:30)",
    "Description": "",
    "Type": "pts-js",
    "Load": {
        "LoadSpec": {
            "Concurrency": {
                "IterationCount": 0,
                "MaxRequestsPerSecond": 0,
                "Stages": [
                    {
                        "DurationSeconds": 120,
                        "TargetVirtualUsers": 2
                    },
                    {
                        "DurationSeconds": 120,
                        "TargetVirtualUsers": 4
                    },
                    {
                        "DurationSeconds": 120,
                        "TargetVirtualUsers": 5
                    },
                    {
                        "DurationSeconds": 240,
                        "TargetVirtualUsers": 5
                    }
                ],
                "Resources": 1
            }
        },
        "GeoRegionsLoadDistribution": [
            {
                "Region": "ap-guangzhou",
                "RegionId": 1,
                "Percentage": 100
            }
        ]
    },
    "Status": 2,
    "ProjectId": "project-abc",
    "TestScripts": [
        {
            "Type": "js",
            "Name": "script.js",
            "Size": 896,
            "EncodedContent": "Ly8gU2VuZCBhIGh0dHAgZ2V0IHJlcXVlc3QKaW1wb3J0IGh0dHAgZnJvbSAncHRzL2h0dHAnOwppbXBvcnQgeyBjaGVjaywgc2xlZXAgfSBmcm9tICdwdHMnOwoKZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gKCkgewogIC8vIHNpbXBsZSBnZXQgcmVxdWVzdAogIGNvbnN0IHJlc3AxID0gaHR0cC5nZXQoJ2h0dHA6Ly9tb2NraHR0cGJpbi5wdHMuc3ZjLmNsdXN0ZXIubG9jYWwvZ2V0Jyk7CiAgY29uc29sZS5sb2cocmVzcDEuYm9keSk7CiAgLy8gaWYgcmVzcDEuYm9keSBpcyBhIGpzb24gc3RyaW5nLCByZXNwMS5qc29uKCkgdHJhbnNmZXIganNvbiBmb3JtYXQgYm9keSB0byBhIGpzb24gb2JqZWN0CiAgY29uc29sZS5sb2cocmVzcDEuanNvbigpKTsKICBjaGVjaygnc3RhdHVzIGlzIDIwMCcsICgpID0+IHJlc3AxLnN0YXR1c0NvZGUgPT09IDIwMCwgcmVzcDEpOwoKICAvLyBzbGVlcCAxIHNlY29uZAogIHNsZWVwKDEpOwoKICAvLyBnZXQgcmVxdWVzdCB3aXRoIGhlYWRlcnMgYW5kIHBhcmFtZXRlcnMKICBjb25zdCByZXNwMiA9IGh0dHAuZ2V0KCdodHRwOi8vbW9ja2h0dHBiaW4ucHRzLnN2Yy5jbHVzdGVyLmxvY2FsL2dldCcsIHsKICAgIGhlYWRlcnM6IHsKICAgICAgQ29ubmVjdGlvbjogJ2tlZXAtYWxpdmUnLAogICAgICAnVXNlci1BZ2VudCc6ICdwdHMtZW5naW5lJywKICAgIH0sCiAgICBxdWVyeTogewogICAgICBuYW1lMTogJ3ZhbHVlMScsCiAgICAgIG5hbWUyOiAndmFsdWUyJywKICAgIH0sCiAgfSk7CgogIGNvbnNvbGUubG9nKHJlc3AyLmpzb24oKS5hcmdzLm5hbWUxKTsgLy8gJ3ZhbHVlMScKICBjaGVjaygnYm9keS5hcmdzLm5hbWUxIGVxdWFscyB2YWx1ZTEnLCAoKSA9PiByZXNwMi5qc29uKCkuYXJncy5uYW1lMSA9PT0gJ3ZhbHVlMScsIHJlc3AyKTsKfQo=",
            "LoadWeight": 100,
            "UpdatedAt": "2023-05-12T16:12:31+08:00",
            "EncodedHttpArchive": ""
        }
    ],
    "SLAPolicy": {
        "SLARules": [],
        "AlertChannel": {}
    },
    "DomainNameConfig": {},
    "Owner": "abc"
}

Output Example

{
    "Response": {
        "RequestId": "31446d02-c4f3-4a53-9efe-b5ad18cfcb7f"
    }
}

5. Developer Resources

SDK

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 CAM signature/authentication error.
FailedOperation Operation failed.
FailedOperation.DbQueryFailed Failed to query database.
FailedOperation.DbRecordCreateFailed Failed to create database record.
FailedOperation.DbRecordUpdateFailed Failed to update database record.
FailedOperation.ResourceNotFound The resource does not exist.
InternalError Internal error.
InvalidParameter Invalid parameter.
InvalidParameterValue Invalid parameter value.
本页内容是否解决了您的问题?
您也可以 联系销售 提交工单 以寻求帮助。

文档反馈