API 呼び出し説明
ストレージスペースを追加した後、本 API を呼び出してスペース内にフォルダーを追加できます。- ストレージスペースタイプが USER の場合、スペースの権限を持つユーザーは操作権限を持ちます。その他の社員が操作するには、権限の追加 API を呼び出して権限付与を行ってください。
- ストレージスペースタイプが APP の場合、誰が操作する場合でも 権限の追加 API を呼び出して権限付与を行う必要があります。
リクエスト
基本情報
| フィールド | 値 |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/storage/spaces/{spaceId}/dentries/{parentId}/folders |
| HTTP Method | POST |
| サポートするアプリタイプ | appType-社内アプリ appType-サードパーティ社内アプリ |
| 必要な権限 | permission-Storage.File.Write-企業ストレージファイル書き込み権限 |
リクエストヘッダー
| 名前 | タイプ | 必須 | 説明 |
|---|---|---|---|
| x-acs-dingtalk-access-token | String | はい | 本 API を呼び出すためのアクセス認証情報。以下の方法で取得します。 - 社内アプリの場合、社内アプリの accessToken を取得 API を呼び出して取得します。 - サードパーティ社内アプリの場合、サードパーティアプリの認可企業の accessToken を取得 API を呼び出して取得します。 |
パスパラメータ
| 名前 | タイプ | 必須 | 説明 |
|---|---|---|---|
| spaceId | String | はい | スペース ID。スペースの追加 API を呼び出して id パラメータの値を取得できます。 |
| parentId | String | はい | 親ディレクトリ ID。ファイルまたはフォルダーリストの取得 API を呼び出して取得します。ルートディレクトリの場合は 0 を指定します。 |
クエリパラメータ
| 名前 | タイプ | 必須 | 説明 |
|---|---|---|---|
| unionId | String | はい | 操作者の unionId。ユーザー詳細の照会 API を呼び出して取得できます。 |
リクエストボディ
| 名前 | タイプ | 必須 | 説明 | |
|---|---|---|---|---|
| name | String | はい | フォルダーの名前。命名には以下の要件があります。- 先頭と末尾に空白を含めることはできません(含めた場合は自動的に削除されます)。 - 特殊文字(タブ、*、"、<、>、` | )を含めることはできません。 - .` で終わることはできません。 |
| option | Object | いいえ | オプションパラメータ。 | |
| conflictStrategy | String | いいえ | フォルダー名が重複した場合の処理戦略。 - AUTO_RENAME:自動的に名前を変更(デフォルト) - OVERWRITE:上書き - RETURN_DENTRY_IF_EXISTS:既存のフォルダーを返す - RETURN_ERROR_IF_EXISTS:フォルダーが既に存在する場合はエラーを返す | |
| appProperties | Array | いいえ | 現在のフォルダーのアプリ属性リスト。最大 3 件。 | |
| name | String | はい | 属性名。 | |
| value | String | はい | 属性値。 | |
| visibility | String | はい | 属性の可視性。 - PUBLIC:すべてのアプリから可視 - PRIVATE:現在のアプリのみ可視 |
リクエスト例
HTTPPOST /v1.0/storage/spaces/833xxxxx/dentries/0/folders?unionId=cHtUxxxxx HTTP/1.1
Host:api.dingtalk.io
x-acs-dingtalk-access-token:xxxxx
Content-Type:application/json
{
"name" : "テストフォルダー",
"option" : {
"conflictStrategy" : "AUTO_RENAME",
"appProperties" : [ {
"name" : "属性1",
"value" : "属性値1",
"visibility" : "PUBLIC"
} ]
}
}
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.sample;
import com.aliyun.tea.*;
public class Sample {
/**
* トークンを使用してアカウントクライアントを初期化
* @return Client
* @throws Exception
*/
public static com.aliyun.dingtalkstorage_1_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_1_0.Client(config);
}
public static void main(String[] args_) throws Exception {
java.util.List<String> args = java.util.Arrays.asList(args_);
com.aliyun.dingtalkstorage_1_0.Client client = Sample.createClient();
com.aliyun.dingtalkstorage_1_0.models.AddFolderHeaders addFolderHeaders = new com.aliyun.dingtalkstorage_1_0.models.AddFolderHeaders();
addFolderHeaders.xAcsDingtalkAccessToken = "<your access token>";
com.aliyun.dingtalkstorage_1_0.models.AddFolderRequest.AddFolderRequestOptionAppProperties optionAppProperties0 = new com.aliyun.dingtalkstorage_1_0.models.AddFolderRequest.AddFolderRequestOptionAppProperties()
.setName("属性1")
.setValue("属性値1")
.setVisibility("PUBLIC");
com.aliyun.dingtalkstorage_1_0.models.AddFolderRequest.AddFolderRequestOption option = new com.aliyun.dingtalkstorage_1_0.models.AddFolderRequest.AddFolderRequestOption()
.setConflictStrategy("AUTO_RENAME")
.setAppProperties(java.util.Arrays.asList(
optionAppProperties0
));
com.aliyun.dingtalkstorage_1_0.models.AddFolderRequest addFolderRequest = new com.aliyun.dingtalkstorage_1_0.models.AddFolderRequest()
.setUnionId("cHtUxxxxx")
.setName("テストフォルダー")
.setOption(option);
try {
client.addFolderWithOptions("833xxxxx", "0", addFolderRequest, addFolderHeaders, 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 には code と message 属性が含まれており、開発時の問題特定に役立ちます
}
} 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 には code と message 属性が含まれており、開発時の問題特定に役立ちます
}
}
}
}
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys
from typing import List
from alibabacloud_dingtalk.storage_1_0.client import Client as dingtalkstorage_1_0Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_dingtalk.storage_1_0 import models as dingtalkstorage__1__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_1_0Client:
"""
トークンを使用してアカウントクライアントを初期化
@return: Client
@throws Exception
"""
config = open_api_models.Config()
config.protocol = 'https'
config.region_id = 'central'
return dingtalkstorage_1_0Client(config)
@staticmethod
def main(
args: List[str],
) -> None:
client = Sample.create_client()
add_folder_headers = dingtalkstorage__1__0_models.AddFolderHeaders()
add_folder_headers.x_acs_dingtalk_access_token = '<your access token>'
option_app_properties_0 = dingtalkstorage__1__0_models.AddFolderRequestOptionAppProperties(
name='属性1',
value='属性値1',
visibility='PUBLIC'
)
option = dingtalkstorage__1__0_models.AddFolderRequestOption(
conflict_strategy='AUTO_RENAME',
app_properties=[
option_app_properties_0
]
)
add_folder_request = dingtalkstorage__1__0_models.AddFolderRequest(
union_id='cHtUxxxxx',
name='テストフォルダー',
option=option
)
try:
client.add_folder_with_options('833xxxxx', '0', add_folder_request, add_folder_headers, util_models.RuntimeOptions())
except Exception as err:
if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
# err には code と message 属性が含まれており、開発時の問題特定に役立ちます
pass
@staticmethod
async def main_async(
args: List[str],
) -> None:
client = Sample.create_client()
add_folder_headers = dingtalkstorage__1__0_models.AddFolderHeaders()
add_folder_headers.x_acs_dingtalk_access_token = '<your access token>'
option_app_properties_0 = dingtalkstorage__1__0_models.AddFolderRequestOptionAppProperties(
name='属性1',
value='属性値1',
visibility='PUBLIC'
)
option = dingtalkstorage__1__0_models.AddFolderRequestOption(
conflict_strategy='AUTO_RENAME',
app_properties=[
option_app_properties_0
]
)
add_folder_request = dingtalkstorage__1__0_models.AddFolderRequest(
union_id='cHtUxxxxx',
name='テストフォルダー',
option=option
)
try:
await client.add_folder_with_options_async('833xxxxx', '0', add_folder_request, add_folder_headers, util_models.RuntimeOptions())
except Exception as err:
if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
# err には code と message 属性が含まれており、開発時の問題特定に役立ちます
pass
if __name__ == '__main__':
Sample.main(sys.argv[1:])
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Sample;
use AlibabaCloud\SDK\Dingtalk\Vstorage_1_0\Dingtalk;
use \Exception;
use AlibabaCloud\Tea\Exception\TeaError;
use AlibabaCloud\Tea\Utils\Utils;
use Darabonba\OpenApi\Models\Config;
use AlibabaCloud\SDK\Dingtalk\Vstorage_1_0\Models\AddFolderHeaders;
use AlibabaCloud\SDK\Dingtalk\Vstorage_1_0\Models\AddFolderRequest\option\appProperties;
use AlibabaCloud\SDK\Dingtalk\Vstorage_1_0\Models\AddFolderRequest\option;
use AlibabaCloud\SDK\Dingtalk\Vstorage_1_0\Models\AddFolderRequest;
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
class Sample {
/**
* トークンを使用してアカウントクライアントを初期化
* @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();
$addFolderHeaders = new AddFolderHeaders([]);
$addFolderHeaders->xAcsDingtalkAccessToken = "<your access token>";
$optionAppProperties0 = new appProperties([
"name" => "属性1",
"value" => "属性値1",
"visibility" => "PUBLIC"
]);
$option = new option([
"conflictStrategy" => "AUTO_RENAME",
"appProperties" => [
$optionAppProperties0
]
]);
$addFolderRequest = new AddFolderRequest([
"unionId" => "cHtUxxxxx",
"name" => "テストフォルダー",
"option" => $option
]);
try {
$client->addFolderWithOptions("833xxxxx", "0", $addFolderRequest, $addFolderHeaders, 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 には code と message 属性が含まれており、開発時の問題特定に役立ちます
}
}
}
}
$path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
if (file_exists($path)) {
require_once $path;
}
Sample::main(array_slice($argv, 1));
// This file is auto-generated, don't edit it. Thanks.
package main
import (
"os"
util "github.com/alibabacloud-go/tea-utils/service"
dingtalkstorage_1_0 "github.com/alibabacloud-go/dingtalk/storage_1_0"
openapi "github.com/alibabacloud-go/darabonba-openapi/client"
"github.com/alibabacloud-go/tea/tea"
)
/**
* トークンを使用してアカウントクライアントを初期化
* @return Client
* @throws Exception
*/
func CreateClient () (_result *dingtalkstorage_1_0.Client, _err error) {
config := &openapi.Config{}
config.Protocol = tea.String("https")
config.RegionId = tea.String("central")
_result = &dingtalkstorage_1_0.Client{}
_result, _err = dingtalkstorage_1_0.NewClient(config)
return _result, _err
}
func _main (args []*string) (_err error) {
client, _err := CreateClient()
if _err != nil {
return _err
}
addFolderHeaders := &dingtalkstorage_1_0.AddFolderHeaders{}
addFolderHeaders.XAcsDingtalkAccessToken = tea.String("<your access token>")
optionAppProperties0 := &dingtalkstorage_1_0.AddFolderRequestOptionAppProperties{
Name: tea.String("属性1"),
Value: tea.String("属性値1"),
Visibility: tea.String("PUBLIC"),
}
option := &dingtalkstorage_1_0.AddFolderRequestOption{
ConflictStrategy: tea.String("AUTO_RENAME"),
AppProperties: []*dingtalkstorage_1_0.AddFolderRequestOptionAppProperties{optionAppProperties0},
}
addFolderRequest := &dingtalkstorage_1_0.AddFolderRequest{
UnionId: tea.String("cHtUxxxxx"),
Name: tea.String("テストフォルダー"),
Option: option,
}
tryErr := func()(_e error) {
defer func() {
if r := tea.Recover(recover()); r != nil {
_e = r
}
}()
_, _err = client.AddFolderWithOptions(tea.String("833xxxxx"), tea.String("0"), addFolderRequest, addFolderHeaders, &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 には code と message 属性が含まれており、開発時の問題特定に役立ちます
}
}
return _err
}
func main() {
err := _main(tea.StringSlice(os.Args[1:]))
if err != nil {
panic(err)
}
}
// This file is auto-generated, don't edit it
import Util, * as $Util from '@alicloud/tea-util';
import dingtalkstorage_1_0, * as $dingtalkstorage_1_0 from '@alicloud/dingtalk/storage_1_0';
import OpenApi, * as $OpenApi from '@alicloud/openapi-client';
import * as $tea from '@alicloud/tea-typescript';
export default class Client {
/**
* トークンを使用してアカウントクライアントを初期化
* @return Client
* @throws Exception
*/
static createClient(): dingtalkstorage_1_0 {
let config = new $OpenApi.Config({ });
config.protocol = "https";
config.regionId = "central";
return new dingtalkstorage_1_0(config);
}
static async main(args: string[]): Promise<void> {
let client = Client.createClient();
let addFolderHeaders = new $dingtalkstorage_1_0.AddFolderHeaders({ });
addFolderHeaders.xAcsDingtalkAccessToken = "<your access token>";
let optionAppProperties0 = new $dingtalkstorage_1_0.AddFolderRequestOptionAppProperties({
name: "属性1",
value: "属性値1",
visibility: "PUBLIC",
});
let option = new $dingtalkstorage_1_0.AddFolderRequestOption({
conflictStrategy: "AUTO_RENAME",
appProperties: [
optionAppProperties0
],
});
let addFolderRequest = new $dingtalkstorage_1_0.AddFolderRequest({
unionId: "cHtUxxxxx",
name: "テストフォルダー",
option: option,
});
try {
await client.addFolderWithOptions("833xxxxx", "0", addFolderRequest, addFolderHeaders, new $Util.RuntimeOptions({ }));
} catch (err) {
if (!Util.empty(err.code) && !Util.empty(err.message)) {
// err には code と message 属性が含まれており、開発時の問題特定に役立ちます
}
}
}
}
Client.main(process.argv.slice(2));
// 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
{
/**
* トークンを使用してアカウントクライアントを初期化
* @return Client
* @throws Exception
*/
public static AlibabaCloud.SDK.Dingtalkstorage_1_0.Client CreateClient()
{
AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config();
config.Protocol = "https";
config.RegionId = "central";
return new AlibabaCloud.SDK.Dingtalkstorage_1_0.Client(config);
}
public static void Main(string[] args)
{
AlibabaCloud.SDK.Dingtalkstorage_1_0.Client client = CreateClient();
AlibabaCloud.SDK.Dingtalkstorage_1_0.Models.AddFolderHeaders addFolderHeaders = new AlibabaCloud.SDK.Dingtalkstorage_1_0.Models.AddFolderHeaders();
addFolderHeaders.XAcsDingtalkAccessToken = "<your access token>";
AlibabaCloud.SDK.Dingtalkstorage_1_0.Models.AddFolderRequest.AddFolderRequestOption.AddFolderRequestOptionAppProperties optionAppProperties0 = new AlibabaCloud.SDK.Dingtalkstorage_1_0.Models.AddFolderRequest.AddFolderRequestOption.AddFolderRequestOptionAppProperties
{
Name = "属性1",
Value = "属性値1",
Visibility = "PUBLIC",
};
AlibabaCloud.SDK.Dingtalkstorage_1_0.Models.AddFolderRequest.AddFolderRequestOption option = new AlibabaCloud.SDK.Dingtalkstorage_1_0.Models.AddFolderRequest.AddFolderRequestOption
{
ConflictStrategy = "AUTO_RENAME",
AppProperties = new List<AlibabaCloud.SDK.Dingtalkstorage_1_0.Models.AddFolderRequest.AddFolderRequestOption.AddFolderRequestOptionAppProperties>
{
optionAppProperties0
},
};
AlibabaCloud.SDK.Dingtalkstorage_1_0.Models.AddFolderRequest addFolderRequest = new AlibabaCloud.SDK.Dingtalkstorage_1_0.Models.AddFolderRequest
{
UnionId = "cHtUxxxxx",
Name = "テストフォルダー",
Option = option,
};
try
{
client.AddFolderWithOptions("833xxxxx", "0", addFolderRequest, addFolderHeaders, new AlibabaCloud.TeaUtil.Models.RuntimeOptions());
}
catch (TeaException err)
{
if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message))
{
// err には code と message 属性が含まれており、開発時の問題特定に役立ちます
}
}
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 には code と message 属性が含まれており、開発時の問題特定に役立ちます
}
}
}
}
}
レスポンス
レスポンスボディ
| 名前 | タイプ | 説明 |
|---|---|---|
| dentry | Object | フォルダー情報。 |
| id | String | フォルダー ID。 |
| spaceId | String | 所属するスペース ID。 |
| parentId | String | 親ディレクトリ ID。 このフィールドが 0 の場合は、ルートディレクトリを示します。 |
| type | String | タイプ。本 API の戻り値は固定値です。 - FOLDER:フォルダー |
| name | String | フォルダーの名前。 |
| size | Long | サイズ(単位:Byte)。 本 API でフォルダーを追加した場合、このフィールドは返されません。 |
| path | String | スペース内でのフォルダーのパス。 |
| version | Long | バージョン。 本 API でフォルダーを追加した場合、このフィールドは返されません。 |
| status | String | ステータス。 - NORMAL:正常 - DELETED:削除済み |
| extension | String | 拡張子。 本 API でフォルダーを追加した場合、このフィールドは返されません。 |
| creatorId | String | 作成者の unionId。 |
| modifierId | String | 編集者の unionId。 |
| createTime | String | 作成時間(iso8601 形式、例:2022-07-29T14:55Z)。 |
| modifiedTime | String | 編集時間(iso8601 形式、例:2022-07-29T14:55Z)。 |
| properties | Object | フォルダー属性。 |
| readOnly | Boolean | 閲覧のみかどうか。 - true:はい - false:いいえ |
| appProperties | Map<String, Array> | 特定アプリでの属性。key はスペースの ownerId、value は属性リストです。 |
| Array | 属性リスト。 | |
| name | String | 属性名。 |
| value | String | 属性値。 |
| visibility | String | 属性の可視性。 - PUBLIC:すべてのアプリから可視 - PRIVATE:現在のアプリのみ可視 |
| uuid | String | 識別フィールド。 |
| partitionType | String | ストレージパーティション。 - PUBLIC_OSS_PARTITION:パブリッククラウド OSS ストレージパーティション - MINI_OSS_PARTITION:専用 MiniOSS ストレージパーティション |
| storageDriver | String | ドライバータイプ。 - DINGTALK:DingTalk 統合ストレージドライバー - ALIDOC:DingTalk ドキュメントストレージドライバー - UNKNOWN:不明なドライバー |
レスポンスボディ例
HTTP/1.1 200 OK
Content-Type:application/json
{
"dentry" : {
"id" : "123",
"spaceId" : "854xxxxx",
"parentId" : "0",
"type" : "FOLDER",
"name" : "テストフォルダー",
"size" : 512,
"path" : "/テストフォルダー",
"version" : 1,
"status" : "NORMAL",
"extension" : "txt",
"creatorId" : "cHtUxxxxx",
"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"
}
}
エラーコード
本 API の呼び出しでエラーが発生した場合は、エラーメッセージをもとに グローバルエラーコード ドキュメントで解決方法を検索してください。| HttpCode | エラーコード | エラーメッセージ | 説明 |
|---|---|---|---|
| 400 | operationConcurrentControl | %s | 同時実行制御 |
| 400 | paramError | %s | パラメータエラー |
| 400 | paramError.conflictStrategy | %s | パラメータエラー-conflictStrategy |
| 400 | dentryNameIllegal | %s | ファイル名が不正 |
| 400 | dentryAlreadyExist | %s | ファイルが既に存在 |
| 403 | permissionDenied | %s | ユーザーにフォルダーを追加する権限がありません |
| 404 | dentryNotExist | %s | 親ディレクトリが存在しません |
| 500 | systemError | %s | システムエラー |
| 500 | unknownError | Unknown Error | 不明なエラー |
| 503 | operationTimeout | %s | リクエストタイムアウト |