Skip to main content
Call this API to commit a file.

API call description

The API call steps are as follows: Step 1: Call the Obtain file upload information API to obtain the information required for uploading the file. Step 2: Upload the file by using the OSS header sign request method. Refer to the following examples: Java
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
public void test(){
               // Get the URL from the API response
                String resourceUrl = "resourceUrls obtained from the API in step 1";
              // Get the headers from the API response
                Map<String, String> headers = headers obtained from the API in step 1;
                URL url = new URL(resourceUrl);
                HttpURLConnection connection = (HttpURLConnection)url.openConnection();
               if (headers != null) {
                for (Map.Entry<String, String> entry : headers.entrySet()) {
                    connection.setRequestProperty(entry.getKey(), entry.getValue());
                }
            }
                connection.setDoOutput(true);
                connection.setRequestMethod("PUT");
                connection.setUseCaches(false);
                connection.setReadTimeout(10000);
                connection.setConnectTimeout(10000);
                connection.connect();
                OutputStream out = connection.getOutputStream();
                InputStream is = new FileInputStream(new File("/Users/xxxxx/Desktop/test_file.xls"));
                byte[] b =new byte[1024];
                int temp;
                while ((temp=is.read(b))!=-1){
                       out.write(b,0,temp);
                }
                out.flush();
                out.close();
                int responseCode = connection.getResponseCode();
                connection.disconnect();
                if (responseCode == 200) {
                    System.out.println("Upload succeeded");
                 } else {
                    System.out.println("Upload failed");
                 }
}
Python
#!/usr/bin/env python

import requests

url = '<resourceUrl obtained from the API in step 1>'
headers = <headers returned by the API in step 1>
result = requests.put(url, data=open('<path_to_file>', 'rb'), headers=headers)
print(result)
C#
public static string HttpRequest(string url, string filePath, Dictionary<string, string> headers) {

    FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
    BinaryReader reader = new BinaryReader(fileStream);
    reader.BaseStream.Seek(0, SeekOrigin.Begin);
    byte[] datas = reader.ReadBytes((int)reader.BaseStream.Length);
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
    request.Method = "PUT";
    request.Timeout = 150000;
    foreach (var header in headers) {
        request.Headers.Add($"{header.Key}", $"{header.Value}");
    }
    Stream requestStream = null;
    string responseStr = null;
    try {
        if (datas != null) {
            request.ContentLength = datas.Length;
            requestStream = request.GetRequestStream();
            requestStream.Write(datas, 0, datas.Length);
            requestStream.Close();
        } else {
            request.ContentLength = 0;
        }
        HttpWebResponse response = request.GetResponse() as HttpWebResponse;
        responseStr = response.Headers.GetValues("x-oss-request-id")[0];
    } catch (Exception ex) {
        Console.WriteLine("error");
    } finally {
        request = null;
        requestStream = null;
    }
    return responseStr;
}
PHP
$url = $result->body->headerSignatureInfo->resourceUrls[0];
$headersSource = $result->body->headerSignatureInfo->headers;
foreach ($headersSource as $key => $value) {
$headers[] = $key . ': ' . $value;
}
// You must explicitly set Content-Type to empty
$headers['Content-Type'] = '';

$file = '/Users/dengxian.ldx/Desktop/test.txt';

$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_TIMEOUT => 100,
CURLOPT_CONNECTTIMEOUT => 100,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_PUT => true,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
));
curl_setopt($ch, CURLOPT_INFILE, fopen($file , 'rb'));
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file) );
curl_setopt($ch, CURLOPT_UPLOAD, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response .PHP_EOL;
Node.js
const fs = require('fs');
const request = require('request-promise');

url = <url>;
header = <headers>;

// Note: You must explicitly set content-type to empty
headers['content-type']='';

var options = {
  method: 'PUT',
  url: url,
  headers: headers
};

fs.createReadStream('/Users/dengxian.ldx/temp/test/a.txt').pipe(request(options)).then(body =>{
  console.log(body);
}).catch(err => {
  console.log(err);
});
Step 3: Call this API to commit the file and complete the upload.

Notes

  • When the storage space type is USER, all users with permissions on the space have operation rights. Other employees must call the Add permissions API to grant authorization.
  • When the storage space type is APP, any operator must call the Add permissions API to grant authorization.

request

Basic information

FieldValue
HTTP URLhttps://api.dingtalk.io/v2.0/storage/spaces/files/{parentDentryUuid}/commit
HTTP MethodPOST
Supported app typesappType-Internal app appType-Third-party enterprise app
Permission requirementspermission-Storage.File.Write-Organization storage file write permission

request header

NameTypeRequiredDescription
x-acs-dingtalk-access-tokenStringYesThe access credential for calling this API. Obtain it as follows: - For an internal app, call the Obtain the access token of an internal app API. - For a third-party enterprise app, call the Obtain the access token of an authorized enterprise of a third-party app API.

path parameter

NameTypeRequiredDescription
parentDentryUuidStringYesThe dentryUuid of the parent node. Call the File Search or Get dentryUuid information API to obtain the dentryUuid field from the response. For the space root directory, pass the dentryUuid of the space root directory.

query parameter

NameTypeRequiredDescription
unionIdStringYesThe unionId of the user. Call the Query user details API to obtain it.

request body

NameTypeRequiredDescription
uploadKeyStringYesThe unique identifier of the file to add. Call the Obtain file upload information API to obtain the value of the uploadKey parameter.
nameStringYesThe file name, including the extension. Naming rules:- No leading or trailing spaces; otherwise they are automatically trimmed. - No special characters, including tab, *, ", <, >, `. - Must not end with .`.
optionObjectNoOptional parameters.
sizeLongNoThe default file size, in bytes. If this field is not empty, the organization storage system verifies whether the actual file size matches this value. A mismatch causes an error.
conflictStrategyStringNoThe file name conflict strategy. - AUTO_RENAME: Automatically rename. Default. - OVERWRITE: Overwrite. - RETURN_DENTRY_IF_EXISTS: Return the existing file. - RETURN_ERROR_IF_EXISTS: Return an error if the file already exists.
appPropertiesArrayNoThe app property list of the current file. Maximum: 3.
nameStringYesThe property name. The property name must be unique within the current app. Properties with the same name across different apps do not affect each other.
valueStringYesThe property value.
visibilityStringYesThe property visibility. - PUBLIC: Visible to all apps. - PRIVATE: Visible only to the current app.
convertToOnlineDocBooleanNoWhether to convert to an online document. - false (default): No. - true: Yes.

Request example

HTTP
POST /v2.0/storage/spaces/files/uuid/commit?unionId=union_id HTTP/1.1
Host:api.dingtalk.io
x-acs-dingtalk-access-token:xxxxx
Content-Type:application/json

{
  "uploadKey" : "upload_key",
  "name" : "dentry_name",
  "option" : {
    "size" : 512,
    "conflictStrategy" : "AUTO_RENAME",
    "appProperties" : [ {
      "name" : "property_name",
      "value" : "property_value",
      "visibility" : "PRIVATE"
    } ],
    "convertToOnlineDoc" : false
  }
}
Java
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * Initialize the account Client with a Token
     * @return Client
     * @throws Exception
     */
    public static com.aliyun.dingtalkstorage_2_0.Client createClient() throws Exception {
        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config();
        config.protocol = "https";
        config.regionId = "central";
        return new com.aliyun.dingtalkstorage_2_0.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.dingtalkstorage_2_0.Client client = Sample.createClient();
        com.aliyun.dingtalkstorage_2_0.models.CommitFileHeaders commitFileHeaders = new com.aliyun.dingtalkstorage_2_0.models.CommitFileHeaders();
        commitFileHeaders.xAcsDingtalkAccessToken = "<your access token>";
        com.aliyun.dingtalkstorage_2_0.models.CommitFileRequest.CommitFileRequestOptionAppProperties optionAppProperties0 = new com.aliyun.dingtalkstorage_2_0.models.CommitFileRequest.CommitFileRequestOptionAppProperties()
                .setName("property_name")
                .setValue("property_value")
                .setVisibility("PRIVATE");
        com.aliyun.dingtalkstorage_2_0.models.CommitFileRequest.CommitFileRequestOption option = new com.aliyun.dingtalkstorage_2_0.models.CommitFileRequest.CommitFileRequestOption()
                .setSize(512L)
                .setConflictStrategy("AUTO_RENAME")
                .setAppProperties(java.util.Arrays.asList(
                    optionAppProperties0
                ))
                .setConvertToOnlineDoc(false);
        com.aliyun.dingtalkstorage_2_0.models.CommitFileRequest commitFileRequest = new com.aliyun.dingtalkstorage_2_0.models.CommitFileRequest()
                .setUnionId("union_id")
                .setUploadKey("upload_key")
                .setName("dentry_name")
                .setOption(option);
        try {
            client.commitFileWithOptions("uuid", commitFileRequest, commitFileHeaders, new com.aliyun.teautil.models.RuntimeOptions());
        } catch (TeaException err) {
            if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                // err contains code and message properties to help developers locate the issue
            }

        } catch (Exception _err) {
            TeaException err = new TeaException(_err.getMessage(), _err);
            if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                // err contains code and message properties to help developers locate the issue
            }

        }        
    }
}
Python
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys

from typing import List

from alibabacloud_dingtalk.storage_2_0.client import Client as dingtalkstorage_2_0Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_dingtalk.storage_2_0 import models as dingtalkstorage__2__0_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient

class Sample:
    def __init__(self):
        pass

    @staticmethod
    def create_client() -> dingtalkstorage_2_0Client:
        """
        Initialize the account Client with a Token
        @return: Client
        @throws Exception
        """
        config = open_api_models.Config()
        config.protocol = 'https'
        config.region_id = 'central'
        return dingtalkstorage_2_0Client(config)

    @staticmethod
    def main(
        args: List[str],
    ) -> None:
        client = Sample.create_client()
        commit_file_headers = dingtalkstorage__2__0_models.CommitFileHeaders()
        commit_file_headers.x_acs_dingtalk_access_token = '<your access token>'
        option_app_properties_0 = dingtalkstorage__2__0_models.CommitFileRequestOptionAppProperties(
            name='property_name',
            value='property_value',
            visibility='PRIVATE'
        )
        option = dingtalkstorage__2__0_models.CommitFileRequestOption(
            size=512,
            conflict_strategy='AUTO_RENAME',
            app_properties=[
                option_app_properties_0
            ],
            convert_to_online_doc=False
        )
        commit_file_request = dingtalkstorage__2__0_models.CommitFileRequest(
            union_id='union_id',
            upload_key='upload_key',
            name='dentry_name',
            option=option
        )
        try:
            client.commit_file_with_options('uuid', commit_file_request, commit_file_headers, util_models.RuntimeOptions())
        except Exception as err:
            if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
                # err contains code and message properties to help developers locate the issue
                pass

    @staticmethod
    async def main_async(
        args: List[str],
    ) -> None:
        client = Sample.create_client()
        commit_file_headers = dingtalkstorage__2__0_models.CommitFileHeaders()
        commit_file_headers.x_acs_dingtalk_access_token = '<your access token>'
        option_app_properties_0 = dingtalkstorage__2__0_models.CommitFileRequestOptionAppProperties(
            name='property_name',
            value='property_value',
            visibility='PRIVATE'
        )
        option = dingtalkstorage__2__0_models.CommitFileRequestOption(
            size=512,
            conflict_strategy='AUTO_RENAME',
            app_properties=[
                option_app_properties_0
            ],
            convert_to_online_doc=False
        )
        commit_file_request = dingtalkstorage__2__0_models.CommitFileRequest(
            union_id='union_id',
            upload_key='upload_key',
            name='dentry_name',
            option=option
        )
        try:
            await client.commit_file_with_options_async('uuid', commit_file_request, commit_file_headers, util_models.RuntimeOptions())
        except Exception as err:
            if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
                # err contains code and message properties to help developers locate the issue
                pass

if __name__ == '__main__':
    Sample.main(sys.argv[1:])
PHP
<?php

// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Sample;

use AlibabaCloud\SDK\Dingtalk\Vstorage_2_0\Dingtalk;
use \Exception;
use AlibabaCloud\Tea\Exception\TeaError;
use AlibabaCloud\Tea\Utils\Utils;

use Darabonba\OpenApi\Models\Config;
use AlibabaCloud\SDK\Dingtalk\Vstorage_2_0\Models\CommitFileHeaders;
use AlibabaCloud\SDK\Dingtalk\Vstorage_2_0\Models\CommitFileRequest\option\appProperties;
use AlibabaCloud\SDK\Dingtalk\Vstorage_2_0\Models\CommitFileRequest\option;
use AlibabaCloud\SDK\Dingtalk\Vstorage_2_0\Models\CommitFileRequest;
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;

class Sample {

    /**
     * Initialize the account Client with a Token
     * @return Dingtalk Client
     */
    public static function createClient(){
        $config = new Config([]);
        $config->protocol = "https";
        $config->regionId = "central";
        return new Dingtalk($config);
    }

    /**
     * @param string[] $args
     * @return void
     */
    public static function main($args){
        $client = self::createClient();
        $commitFileHeaders = new CommitFileHeaders([]);
        $commitFileHeaders->xAcsDingtalkAccessToken = "<your access token>";
        $optionAppProperties0 = new appProperties([
            "name" => "property_name",
            "value" => "property_value",
            "visibility" => "PRIVATE"
        ]);
        $option = new option([
            "size" => 512,
            "conflictStrategy" => "AUTO_RENAME",
            "appProperties" => [
                $optionAppProperties0
            ],
            "convertToOnlineDoc" => false
        ]);
        $commitFileRequest = new CommitFileRequest([
            "unionId" => "union_id",
            "uploadKey" => "upload_key",
            "name" => "dentry_name",
            "option" => $option
        ]);
        try {
            $client->commitFileWithOptions("uuid", $commitFileRequest, $commitFileHeaders, new RuntimeOptions([]));
        }
        catch (Exception $err) {
            if (!($err instanceof TeaError)) {
                $err = new TeaError([], $err->getMessage(), $err->getCode(), $err);
            }
            if (!Utils::empty_($err->code) && !Utils::empty_($err->message)) {
                // err contains code and message properties to help developers locate the issue
            }
        }
    }
}
$path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
if (file_exists($path)) {
    require_once $path;
}
Sample::main(array_slice($argv, 1));
Go
// This file is auto-generated, don't edit it. Thanks.
package main

import (
  "os"
  util  "github.com/alibabacloud-go/tea-utils/v2/service"
  dingtalkstorage_2_0  "github.com/alibabacloud-go/dingtalk/storage_2_0"
  openapi  "github.com/alibabacloud-go/darabonba-openapi/v2/client"
  "github.com/alibabacloud-go/tea/tea"
)

/**
 * Initialize the account Client with a Token
 * @return Client
 * @throws Exception
 */
func CreateClient () (_result *dingtalkstorage_2_0.Client, _err error) {
  config := &openapi.Config{}
  config.Protocol = tea.String("https")
  config.RegionId = tea.String("central")
  _result = &dingtalkstorage_2_0.Client{}
  _result, _err = dingtalkstorage_2_0.NewClient(config)
  return _result, _err
}

func _main (args []*string) (_err error) {
  client, _err := CreateClient()
  if _err != nil {
    return _err
  }

  commitFileHeaders := &dingtalkstorage_2_0.CommitFileHeaders{}
  commitFileHeaders.XAcsDingtalkAccessToken = tea.String("<your access token>")
  optionAppProperties0 := &dingtalkstorage_2_0.CommitFileRequestOptionAppProperties{
    Name: tea.String("property_name"),
    Value: tea.String("property_value"),
    Visibility: tea.String("PRIVATE"),
  }
  option := &dingtalkstorage_2_0.CommitFileRequestOption{
    Size: tea.Int64(512),
    ConflictStrategy: tea.String("AUTO_RENAME"),
    AppProperties: []*dingtalkstorage_2_0.CommitFileRequestOptionAppProperties{optionAppProperties0},
    ConvertToOnlineDoc: tea.Bool(false),
  }
  commitFileRequest := &dingtalkstorage_2_0.CommitFileRequest{
    UnionId: tea.String("union_id"),
    UploadKey: tea.String("upload_key"),
    Name: tea.String("dentry_name"),
    Option: option,
  }
  tryErr := func()(_e error) {
    defer func() {
      if r := tea.Recover(recover()); r != nil {
        _e = r
      }
    }()
    _, _err = client.CommitFileWithOptions(tea.String("uuid"), commitFileRequest, commitFileHeaders, &util.RuntimeOptions{})
    if _err != nil {
      return _err
    }

    return nil
  }()

  if tryErr != nil {
    var err = &tea.SDKError{}
    if _t, ok := tryErr.(*tea.SDKError); ok {
      err = _t
    } else {
      err.Message = tea.String(tryErr.Error())
    }
    if !tea.BoolValue(util.Empty(err.Code)) && !tea.BoolValue(util.Empty(err.Message)) {
      // err contains code and message properties to help developers locate the issue
    }

  }
  return _err
}

func main() {
  err := _main(tea.StringSlice(os.Args[1:]))
  if err != nil {
    panic(err)
  }
}
Node.js
// This file is auto-generated, don't edit it
import Util, * as $Util from '@alicloud/tea-util';
import dingtalkstorage_2_0, * as $dingtalkstorage_2_0 from '@alicloud/dingtalk/storage_2_0';
import OpenApi, * as $OpenApi from '@alicloud/openapi-client';
import * as $tea from '@alicloud/tea-typescript';

export default class Client {

  /**
   * Initialize the account Client with a Token
   * @return Client
   * @throws Exception
   */
  static createClient(): dingtalkstorage_2_0 {
    let config = new $OpenApi.Config({ });
    config.protocol = "https";
    config.regionId = "central";
    return new dingtalkstorage_2_0(config);
  }

  static async main(args: string[]): Promise<void> {
    let client = Client.createClient();
    let commitFileHeaders = new $dingtalkstorage_2_0.CommitFileHeaders({ });
    commitFileHeaders.xAcsDingtalkAccessToken = "<your access token>";
    let optionAppProperties0 = new $dingtalkstorage_2_0.CommitFileRequestOptionAppProperties({
      name: "property_name",
      value: "property_value",
      visibility: "PRIVATE",
    });
    let option = new $dingtalkstorage_2_0.CommitFileRequestOption({
      size: 512,
      conflictStrategy: "AUTO_RENAME",
      appProperties: [
        optionAppProperties0
      ],
      convertToOnlineDoc: false,
    });
    let commitFileRequest = new $dingtalkstorage_2_0.CommitFileRequest({
      unionId: "union_id",
      uploadKey: "upload_key",
      name: "dentry_name",
      option: option,
    });
    try {
      await client.commitFileWithOptions("uuid", commitFileRequest, commitFileHeaders, new $Util.RuntimeOptions({ }));
    } catch (err) {
      if (!Util.empty(err.code) && !Util.empty(err.message)) {
        // err contains code and message properties to help developers locate the issue
      }

    }    
  }

}

Client.main(process.argv.slice(2));
C#
// This file is auto-generated, don't edit it. Thanks.

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;

using Tea;
using Tea.Utils;

namespace AlibabaCloud.SDK.Sample
{
    public class Sample 
    {

        /**
         * Initialize the account Client with a Token
         * @return Client
         * @throws Exception
         */
        public static AlibabaCloud.SDK.Dingtalkstorage_2_0.Client CreateClient()
        {
            AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config();
            config.Protocol = "https";
            config.RegionId = "central";
            return new AlibabaCloud.SDK.Dingtalkstorage_2_0.Client(config);
        }

        public static void Main(string[] args)
        {
            AlibabaCloud.SDK.Dingtalkstorage_2_0.Client client = CreateClient();
            AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileHeaders commitFileHeaders = new AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileHeaders();
            commitFileHeaders.XAcsDingtalkAccessToken = "<your access token>";
            AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest.CommitFileRequestOption.CommitFileRequestOptionAppProperties optionAppProperties0 = new AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest.CommitFileRequestOption.CommitFileRequestOptionAppProperties
            {
                Name = "property_name",
                Value = "property_value",
                Visibility = "PRIVATE",
            };
            AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest.CommitFileRequestOption option = new AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest.CommitFileRequestOption
            {
                Size = 512,
                ConflictStrategy = "AUTO_RENAME",
                AppProperties = new List<AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest.CommitFileRequestOption.CommitFileRequestOptionAppProperties>
                {
                    optionAppProperties0
                },
                ConvertToOnlineDoc = false,
            };
            AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest commitFileRequest = new AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest
            {
                UnionId = "union_id",
                UploadKey = "upload_key",
                Name = "dentry_name",
                Option = option,
            };
            try
            {
                client.CommitFileWithOptions("uuid", commitFileRequest, commitFileHeaders, new AlibabaCloud.TeaUtil.Models.RuntimeOptions());
            }
            catch (TeaException err)
            {
                if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message))
                {
                    // err contains code and message properties to help developers locate the issue
                }
            }
            catch (Exception _err)
            {
                TeaException err = new TeaException(new Dictionary<string, object>
                {
                    { "message", _err.Message }
                });
                if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message))
                {
                    // err contains code and message properties to help developers locate the issue
                }
            }
        }

    }
}

response

response body

NameTypeDescription
dentryObjectFile information.
idStringThe file ID.
spaceIdStringThe ID of the space the file belongs to.
parentIdStringThe parent directory ID. For the root directory, this value is 0. An empty value means the root directory has no parentId.
typeStringThe type, either directory or file. Enum values: - FILE: File. - FOLDER: Folder.
nameStringThe file name.
sizeLongThe file size, in bytes.
pathStringThe file path within the space.
versionLongThe version.
statusStringThe status: - NORMAL: Normal. - DELETED: Deleted. - EXPIRED: Expired.
extensionStringThe file extension.
creatorIdStringThe unionId of the creator.
modifierIdStringThe unionId of the modifier.
createTimeStringThe created time in ISO 8601 format, for example, 2022-07-29T14:55Z.
modifiedTimeStringThe modified time in ISO 8601 format, for example, 2022-07-29T14:55Z.
propertiesObjectFile properties.
readOnlyBooleanWhether the file is read-only. - true: Yes. - false: No.
appPropertiesMap<String, Array>Properties on specific apps. The key is the ownerId of the space, and the value is the property list.
ArrayThe property list.
nameStringThe property name.
valueStringThe property value.
visibilityStringThe property visibility. - PUBLIC: Visible to all apps. - PRIVATE: Visible only to the current app.
uuidStringThe unique identifier uuid. This field does not change when the file is moved.
partitionTypeStringThe storage partition: - PUBLIC_OSS_PARTITION: Public cloud OSS storage partition. - MINI_OSS_PARTITION: Dedicated MiniOSS storage partition.
storageDriverStringThe driver type. Enum values: - DINGTALK: DingTalk unified storage driver. - ALIDOC: DingTalk Docs storage driver. - SHANJI: Shanji storage driver. - UNKNOWN: Unknown driver.
thumbnailObjectThumbnail information.
widthIntegerThe thumbnail width.
heightIntegerThe thumbnail height.
urlStringThe thumbnail URL.
categoryStringThe category. Enum values: - IMAGE: Image. - VIDEO: Video. - AUDIO: Audio. - ARCHIVE: Archive. - SHORTCUT: Shortcut. - DOCUMENT: Document. - ALI_DOC: DingTalk Docs. - OTHER: Other.

Response body example

HTTP/1.1 200 OK
Content-Type:application/json

{
  "dentry" : {
    "id" : "dentry_id",
    "spaceId" : "space_id",
    "parentId" : "parent_id",
    "type" : "FILE",
    "name" : "dentry_name",
    "size" : 512,
    "path" : "dentry_path",
    "version" : 1,
    "status" : "NORMAL",
    "extension" : "txt",
    "creatorId" : "creator_id",
    "modifierId" : "modifier_id",
    "createTime" : "2022-01-01T10:00:00Z",
    "modifiedTime" : "2022-01-01T10:00:00Z",
    "properties" : {
      "readOnly" : true
    },
    "appProperties" : [ {
      "name" : "property_name",
      "value" : "property_value",
      "visibility" : "PRIVATE"
    } ],
    "uuid" : "uuid",
    "partitionType" : "PUBLIC_OSS_PARTITION",
    "storageDriver" : "DINGTALK",
    "thumbnail" : {
      "width" : 64,
      "height" : 64,
      "url" : "url"
    },
    "category" : "DOCUMENT"
  }
}

Error codes

If an error is returned when you call this API, find a solution by error message in the Global error codes document.
HttpCodeError codeError messageDescription
400operationConcurrentControl%sConcurrency control.
400paramError%sParameter error.
400paramError.parentDentryUuid%sParameter error - parentDentryUuid.
400paramError.uploadKey%sParameter error - uploadKey.
400paramError.name%sParameter error - name.
400paramError.conflictStrategy%sParameter error - conflictStrategy.
400spaceQuotaInsufficient%sInsufficient space quota.
400sceneQuotaInsufficient%sInsufficient scene quota.
400appQuotaInsufficient%sInsufficient app quota.
400orgQuotaInsufficient%sInsufficient organization quota.
400dentryNameIllegal%sIllegal file name.
400dentryStoreError%sFile storage error.
400dentryNameConflict%sFile name conflict.
400dentryFormatNotSupport%sUnsupported file format.
403permissionDenied%sThe user lacks permission to upload the file.
404spaceNotExist%sThe space does not exist.
500systemError%sSystem error.
500unknownErrorUnknown ErrorUnknown error.
503operationTimeout%sRequest timeout.