Skip to main content
Call this API to get file upload information.

API call description

Description

  • If the spaceId parameter is provided when uploading a file, use the Get file upload information API.
  • If the dentryUuid or uuid parameter is provided when uploading a file, this document is recommended.
The API call flow is as follows: Step 1: Call this API to obtain the resourceUrls and headers parameter values required for file upload. Step 2: Upload the file using the OSS header signature method. Refer to the following examples: Java
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
public void test(){
               // Get resourceUrls from the response of the first API call
                String resourceUrl = "resourceUrls returned by the first API call";
              // Get headers from the response of the first API call
                Map<String, String> headers = headers returned by the first API call;
                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 returned by the first API call>'
headers = <headers returned by the first API call>
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;
}
// 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: 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 the Submit file API to complete the file upload.

Description

  • When the storage space type is USER, users with permission to the space have action permissions. Other employees must call the Add permissions API for authorization.
  • When the storage space type is APP, anyone performing actions must call the Add permissions API for authorization.

Request

Basic information

FieldValue
HTTP URLhttps://api.dingtalk.io/v2.0/storage/spaces/files/{parentDentryUuid}/uploadInfos/query
HTTP MethodPOST
Supported app typesappType-Internal app appType-Third-party enterprise app
Permissions requiredpermission-Storage.UploadInfo.Read-Read permission for organization storage file upload information

Request header

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

Path parameter

NameTypeRequiredDescription
parentDentryUuidStringYesThe dentryUuid of the parent node. Call the Search for files or Get dentryUuid information API to obtain the value of the returned dentryUuid field. For the space root directory, pass the dentryUuid of the space root directory.

Query parameter

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

Request body

NameTypeRequiredDescription
protocolStringYesReturns information required for different upload protocols based on the specified protocol. - HEADER_SIGNATURE: Header signature
optionObjectNoOptional parameters.
storageDriverStringNoThe file storage driver type. Currently, only DINGTALK is supported.
preCheckParamObjectNoFields for pre-check. Used to validate the file name, file integrity, and capacity.
sizeLongNoThe file size, used for capacity-related validation. If not provided, no validation is performed.
nameStringNoThe file name (used for file name validity and file name conflict checks). Rules: - Leading and trailing spaces are not allowed and will be automatically removed. - Cannot contain special characters, including: tab, *, ", <, >, `. - Cannot end with .`.
preferRegionStringNoThe preferred region: - ZHANGJIAKOU: Zhangjiakou - SHENZHEN: Shenzhen - SHANGHAI: Shanghai - SINGAPORE: Singapore - UNKNOWN: Unknown Specifies the region where the resource is preferably stored, enabling features such as nearby upload.
preferIntranetBooleanNoWhether to prioritize intranet transmission. This parameter requires dedicated storage intranet transmission to be configured. - true: Yes (default) - false: No

Request example

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

{
  "protocol" : "HEADER_SIGNATURE",
  "option" : {
    "storageDriver" : "DINGTALK",
    "preCheckParam" : {
      "size" : 512,
      "name" : "dentry_name"
    },
    "preferRegion" : "ZHANGJIAKOU",
    "preferIntranet" : true
  }
}
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 using 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.GetFileUploadInfoHeaders getFileUploadInfoHeaders = new com.aliyun.dingtalkstorage_2_0.models.GetFileUploadInfoHeaders();
        getFileUploadInfoHeaders.xAcsDingtalkAccessToken = "<your access token>";
        com.aliyun.dingtalkstorage_2_0.models.GetFileUploadInfoRequest.GetFileUploadInfoRequestOptionPreCheckParam optionPreCheckParam = new com.aliyun.dingtalkstorage_2_0.models.GetFileUploadInfoRequest.GetFileUploadInfoRequestOptionPreCheckParam()
                .setSize(512L)
                .setName("dentry_name");
        com.aliyun.dingtalkstorage_2_0.models.GetFileUploadInfoRequest.GetFileUploadInfoRequestOption option = new com.aliyun.dingtalkstorage_2_0.models.GetFileUploadInfoRequest.GetFileUploadInfoRequestOption()
                .setStorageDriver("DINGTALK")
                .setPreCheckParam(optionPreCheckParam)
                .setPreferRegion("ZHANGJIAKOU")
                .setPreferIntranet(true);
        com.aliyun.dingtalkstorage_2_0.models.GetFileUploadInfoRequest getFileUploadInfoRequest = new com.aliyun.dingtalkstorage_2_0.models.GetFileUploadInfoRequest()
                .setUnionId("union_id")
                .setProtocol("HEADER_SIGNATURE")
                .setOption(option);
        try {
            client.getFileUploadInfoWithOptions("uuid", getFileUploadInfoRequest, getFileUploadInfoHeaders, 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 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 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 using 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()
        get_file_upload_info_headers = dingtalkstorage__2__0_models.GetFileUploadInfoHeaders()
        get_file_upload_info_headers.x_acs_dingtalk_access_token = '<your access token>'
        option_pre_check_param = dingtalkstorage__2__0_models.GetFileUploadInfoRequestOptionPreCheckParam(
            size=512,
            name='dentry_name'
        )
        option = dingtalkstorage__2__0_models.GetFileUploadInfoRequestOption(
            storage_driver='DINGTALK',
            pre_check_param=option_pre_check_param,
            prefer_region='ZHANGJIAKOU',
            prefer_intranet=True
        )
        get_file_upload_info_request = dingtalkstorage__2__0_models.GetFileUploadInfoRequest(
            union_id='union_id',
            protocol='HEADER_SIGNATURE',
            option=option
        )
        try:
            client.get_file_upload_info_with_options('uuid', get_file_upload_info_request, get_file_upload_info_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 locate the issue
                pass

    @staticmethod
    async def main_async(
        args: List[str],
    ) -> None:
        client = Sample.create_client()
        get_file_upload_info_headers = dingtalkstorage__2__0_models.GetFileUploadInfoHeaders()
        get_file_upload_info_headers.x_acs_dingtalk_access_token = '<your access token>'
        option_pre_check_param = dingtalkstorage__2__0_models.GetFileUploadInfoRequestOptionPreCheckParam(
            size=512,
            name='dentry_name'
        )
        option = dingtalkstorage__2__0_models.GetFileUploadInfoRequestOption(
            storage_driver='DINGTALK',
            pre_check_param=option_pre_check_param,
            prefer_region='ZHANGJIAKOU',
            prefer_intranet=True
        )
        get_file_upload_info_request = dingtalkstorage__2__0_models.GetFileUploadInfoRequest(
            union_id='union_id',
            protocol='HEADER_SIGNATURE',
            option=option
        )
        try:
            await client.get_file_upload_info_with_options_async('uuid', get_file_upload_info_request, get_file_upload_info_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 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\GetFileUploadInfoHeaders;
use AlibabaCloud\SDK\Dingtalk\Vstorage_2_0\Models\GetFileUploadInfoRequest\option\preCheckParam;
use AlibabaCloud\SDK\Dingtalk\Vstorage_2_0\Models\GetFileUploadInfoRequest\option;
use AlibabaCloud\SDK\Dingtalk\Vstorage_2_0\Models\GetFileUploadInfoRequest;
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;

class Sample {

    /**
     * Initialize the account Client using 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();
        $getFileUploadInfoHeaders = new GetFileUploadInfoHeaders([]);
        $getFileUploadInfoHeaders->xAcsDingtalkAccessToken = "<your access token>";
        $optionPreCheckParam = new preCheckParam([
            "size" => 512,
            "name" => "dentry_name"
        ]);
        $option = new option([
            "storageDriver" => "DINGTALK",
            "preCheckParam" => $optionPreCheckParam,
            "preferRegion" => "ZHANGJIAKOU",
            "preferIntranet" => true
        ]);
        $getFileUploadInfoRequest = new GetFileUploadInfoRequest([
            "unionId" => "union_id",
            "protocol" => "HEADER_SIGNATURE",
            "option" => $option
        ]);
        try {
            $client->getFileUploadInfoWithOptions("uuid", $getFileUploadInfoRequest, $getFileUploadInfoHeaders, 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 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 using 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
  }

  getFileUploadInfoHeaders := &dingtalkstorage_2_0.GetFileUploadInfoHeaders{}
  getFileUploadInfoHeaders.XAcsDingtalkAccessToken = tea.String("<your access token>")
  optionPreCheckParam := &dingtalkstorage_2_0.GetFileUploadInfoRequestOptionPreCheckParam{
    Size: tea.Int64(512),
    Name: tea.String("dentry_name"),
  }
  option := &dingtalkstorage_2_0.GetFileUploadInfoRequestOption{
    StorageDriver: tea.String("DINGTALK"),
    PreCheckParam: optionPreCheckParam,
    PreferRegion: tea.String("ZHANGJIAKOU"),
    PreferIntranet: tea.Bool(true),
  }
  getFileUploadInfoRequest := &dingtalkstorage_2_0.GetFileUploadInfoRequest{
    UnionId: tea.String("union_id"),
    Protocol: tea.String("HEADER_SIGNATURE"),
    Option: option,
  }
  tryErr := func()(_e error) {
    defer func() {
      if r := tea.Recover(recover()); r != nil {
        _e = r
      }
    }()
    _, _err = client.GetFileUploadInfoWithOptions(tea.String("uuid"), getFileUploadInfoRequest, getFileUploadInfoHeaders, &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 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 using 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 getFileUploadInfoHeaders = new $dingtalkstorage_2_0.GetFileUploadInfoHeaders({ });
    getFileUploadInfoHeaders.xAcsDingtalkAccessToken = "<your access token>";
    let optionPreCheckParam = new $dingtalkstorage_2_0.GetFileUploadInfoRequestOptionPreCheckParam({
      size: 512,
      name: "dentry_name",
    });
    let option = new $dingtalkstorage_2_0.GetFileUploadInfoRequestOption({
      storageDriver: "DINGTALK",
      preCheckParam: optionPreCheckParam,
      preferRegion: "ZHANGJIAKOU",
      preferIntranet: true,
    });
    let getFileUploadInfoRequest = new $dingtalkstorage_2_0.GetFileUploadInfoRequest({
      unionId: "union_id",
      protocol: "HEADER_SIGNATURE",
      option: option,
    });
    try {
      await client.getFileUploadInfoWithOptions("uuid", getFileUploadInfoRequest, getFileUploadInfoHeaders, new $Util.RuntimeOptions({ }));
    } catch (err) {
      if (!Util.empty(err.code) && !Util.empty(err.message)) {
        // err contains code and message properties to help 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 using 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.GetFileUploadInfoHeaders getFileUploadInfoHeaders = new AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.GetFileUploadInfoHeaders();
            getFileUploadInfoHeaders.XAcsDingtalkAccessToken = "<your access token>";
            AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.GetFileUploadInfoRequest.GetFileUploadInfoRequestOption.GetFileUploadInfoRequestOptionPreCheckParam optionPreCheckParam = new AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.GetFileUploadInfoRequest.GetFileUploadInfoRequestOption.GetFileUploadInfoRequestOptionPreCheckParam
            {
                Size = 512,
                Name = "dentry_name",
            };
            AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.GetFileUploadInfoRequest.GetFileUploadInfoRequestOption option = new AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.GetFileUploadInfoRequest.GetFileUploadInfoRequestOption
            {
                StorageDriver = "DINGTALK",
                PreCheckParam = optionPreCheckParam,
                PreferRegion = "ZHANGJIAKOU",
                PreferIntranet = true,
            };
            AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.GetFileUploadInfoRequest getFileUploadInfoRequest = new AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.GetFileUploadInfoRequest
            {
                UnionId = "union_id",
                Protocol = "HEADER_SIGNATURE",
                Option = option,
            };
            try
            {
                client.GetFileUploadInfoWithOptions("uuid", getFileUploadInfoRequest, getFileUploadInfoHeaders, 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 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 locate the issue
                }
            }
        }

    }
}

Response

Response body

NameTypeDescription
uploadKeyStringThe unique identifier for the upload.
storageDriverStringThe file storage type.
protocolStringThe upload protocol: - HEADER_SIGNATURE: Header signature
headerSignatureInfoObjectThe header signature upload information. Returned when the protocol parameter is set to HEADER_SIGNATURE.
resourceUrlsArray of StringThe transmission URLs.
headersMap<String, String>The request headers. Maximum size: 20.
expirationSecondsIntegerThe expiration time, in seconds.
regionStringThe region. Enum values: - ZHANGJIAKOU: Zhangjiakou - SHENZHEN: Shenzhen - SHANGHAI: Shanghai - SINGAPORE: Singapore - UNKNOWN: Unknown
internalResourceUrlsArray of StringThe intranet URLs. This field is currently unused. Please ignore it.

Response body example

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

{
  "uploadKey" : "upload_key",
  "storageDriver" : "DINGTALK",
  "protocol" : "HEADER_SIGNATURE",
  "headerSignatureInfo" : {
    "resourceUrls" : [ "resourceUrl" ],
    "headers" : {
      "key" : "header_value"
    },
    "expirationSeconds" : 900,
    "region" : "ZHANGJIAKOU",
    "internalResourceUrls" : [ "internalResourceUrl" ]
  }
}

Error codes

If an error occurs when calling this API, look up the error message in the Global error codes document for a solution.
HttpCodeError codeError messageDescription
400paramError%sParameter error
400paramError.protocol%sParameter error - protocol
400paramError.parentDentryUuid%sParameter error - parentDentryUuid
400paramError.storageDriver%sParameter error - storageDriver
400dentryUploadError%sFile upload error
400spaceQuotaInsufficient%sInsufficient space capacity
400sceneQuotaInsufficient%sInsufficient scene capacity
400appQuotaInsufficient%sInsufficient app capacity
400orgQuotaInsufficient%sInsufficient organization capacity
400dentryUploadForbidden%sUpload forbidden
400dentryUploadProtocolNotSupport%sUnsupported upload protocol
403permissionDenied%sUser lacks permission to upload files
404spaceNotExist%sSpace does not exist
500systemError%sSystem error
500unknownErrorUnknown ErrorUnknown error
503operationTimeout%sRequest timeout