tencent cloud

APIs

UpdateFile

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-10-11 15:48:21

1. API Description

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

Update file contents and running configuration (computational resource, default catalog/schema, parameters), and return the file metadata after the update.

Prerequisite

  1. The file corresponding to FileId must exist and be in active status;
  2. The caller has write permission on the file;
  3. To update only the configuration, do not pass in Storage. To update only the content, do not pass in FileConfig.
  4. If FileConfig.ResourceId is not empty, the match between the resource type and file type will be validated.

Error codes (Module: Studio)

Error Code (Code) InnerCode Description Handling Suggestions
MissingParameter.WorkspaceId 1030001 lack of WorkspaceId Please input WorkspaceId
MissingParameter.FileId 1030003 lack of FileId Please import FileId
InvalidParameterValue.FileType 1030102 FileType value not supported FileType takes FILE/NOTEBOOK_FILE/SQL_FILE
InvalidParameterValue.ResourceId 1030104 Compute resource type and file type mismatch Select a computational resource for Python/Notebook and a data analysis resource for SQL
ResourceNotFound.FileNotFound 1030203 File does not exist or has been deleted confirm the FileId or call GetFile to check the file status
UnauthorizedOperation.FileWriteDenied 1030302 No write permission for this file Contact the file owner or space admin for authorization
FailedOperation.FileStorageUpdateFailed 1030401 Failed to write file content to storage Try again later. If the failure persists, contact support with the RequestId.
InternalError 1030900 Internal service error Please carry the RequestId and contact support

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: UpdateFile.
Version Yes String Common Params. The value used for this API: 2026-07-15.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
WorkspaceId Yes String

Workspace ID. Source: WorkspaceId returned by the ListWorkspaces API

FileId Yes String

File ID. Source: FileId returned by the CreateFile / ListFiles / GetFile APIs

FileConfig No FileConfig

File operation configuration. If not passed, the configuration will not be updated.

FileType No String

File type. Parameter Value: FILE (regular file/script), NOTEBOOK_FILE (Notebook), SQL_FILE (SQL file). Corresponds to common/domain/entity.proto EntityType

BundleId No String

Bound BundleId. Source: BundleId returned by the ListBundles API

BundleInfo No String

Bound BundleInfo, JSON string

Storage No FileStorage

File content. If not passed, the content will not be updated.

FileName No String

Target file name. When it is not empty and different from the current file name, perform the rename action. Length not exceeding SCRIPT_NAME_MAX_LENGTH. It must not begin or end with . or .., and spaces, double dots, control characters, and Linux reserved names are forbidden (see docs/linux_filename_rules.md). Validate the suffix legitimacy together with ExtensionType.

ParentFolderPath No String

Target parent directory path. If not empty, execute the move action. For the root directory, pass /; it can simultaneously appear with FileName, with the semantics of "move + rename". It should be consistent with ParentFolderPath of CreateFile.

TargetFileType No String

FileType of the target parent directory. Value: FOLDER, GIT_FOLDER. Used only when ParentFolderPath is not empty; by default, it is handled based on the actual type of the parsed parent directory

UpdateAction No Integer

Action type (optional, default value: 1, mandatory verification in future versions). Value: 1 = UPDATE_CONTENT (only refresh FileConfig / Storage / Bundle, forbid passing FileName / ParentFolderPath / TargetFileType); 2 = RENAME (rename only, must pass FileName, forbid passing ParentFolderPath / FileConfig / Storage / Bundle); 3 = MOVE (move only, must pass ParentFolderPath, forbid passing FileName / FileConfig / Storage / Bundle*). A ParamIllegal error will be returned if parameter mutual exclusion verification fails

3. Output Parameters

Parameter Name Type Description
Data FileInfo

Returned results

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 File Metadata and Content Example

Input Example

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

{
    "WorkspaceId": "17676920188276733",
    "FileId": "872597305364471808",
    "FileType": "NOTEBOOK_FILE",
    "BundleId": "create_test",
    "BundleInfo": "{'key1': 'value1'}",
    "Storage": {
        "StorageType": 1,
        "Content": "ewogICJjZWxscyI6IFsKICAgIHsKICAgICAgImNlbGxfdHlwZSI6ICJjb2RlIiwKICAgICAgImV4ZWN1dGlvbl9jb3VudCI6IG51bGwsCiAgICAgICJtZXRhZGF0YSI6IHt9LAogICAgICAib3V0cHV0cyI6IFtdLAogICAgICAic291cmNlIjogWwogICAgICAgICJwcmludCgxKSIKICAgICAgXSwKICAgICAgImlkIjogImNlbGwtMC0xNzg1ODUxNDg2MTM4IgogICAgfQogIF0sCiAgIm1ldGFkYXRhIjoge30sCiAgIm5iZm9ybWF0IjogNCwKICAibmJmb3JtYXRfbWlub3IiOiA1Cn0="
    }
}

Output Example

{
    "Response": {
        "Data": {
            "AppId": "251436191",
            "BundleId": "create_test",
            "BundleInfo": "{'key1': 'value1'}",
            "CreateTime": "1785851410",
            "CreateUserUin": "700002164618",
            "FileConfig": {
                "AdvanceConfig": "",
                "DefaultCatalog": "",
                "DefaultSchema": "",
                "ExtraParams": "",
                "OutputConf": [],
                "Params": "eyJtbGZsb3dfcHJlX2V4ZWN1dGVfY29zX3BhdGgiOiJodHRwczovL2J1Y2tldC0zMC0yNTE0MzYxOTEuY29zLmFwLWd1YW5nemhvdS5teXFjbG91ZC5jb20vc2NpLzE3Njc2OTIwMTg4Mjc2NzMzL3BlcnNvbmFsLzcwMDAwMjE2NDYxOC84NzI1OTczMDUzNjQ0NzE4MDgvbm90ZWJvb2tfcHJlbG9hZF9zY3JpcHQucHkifQ==",
                "ResourceId": ""
            },
            "FileId": "872597305364471808",
            "FileName": "create_by_api3.ipynb",
            "FileType": "NOTEBOOK_FILE",
            "OwnerUserName": "wedata30-dev@tencent.com",
            "Path": "/Workspace/Users/create_by_api3.ipynb",
            "Permissions": "[MANAGE]",
            "ReleaseStatus": false,
            "ResourceMode": 0,
            "Status": "active",
            "Storage": {
                "Content": "",
                "StoragePath": "",
                "StorageType": 0
            },
            "UpdateTime": "1785851538",
            "UpdateUserUin": "700002164618",
            "WorkspaceId": "17676920188276733"
        },
        "RequestId": "e5e3c887-81f6-45d4-982e-6d43364fe366"
    }
}

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

There is no error code related to the API business logic. For other error codes, please see Common Error Codes.

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백